Simple maths.
If your body needs 2000 calories a day to live on, and you provide it with 3000 calories, may it be all chocolate or all vegetables, you will put on weight as the excess calories are stored as fat.
If you eat 500 calories of pure chocolate a day, you will lose weight (by starving - generally never eat less than 1200) (and suffer from scurvy probably after a while or any other charming vitamin/nutrient deficienty related illness.
Wholemeal food is good for you because it is slowly digested. Eat 200 calories of brown rice (unrefined carb) and it will keep you full for much longer than 200 calories of white bread (refined carb). When you eat refined carbs, your blood sugars creep up considerably, so your body tries to bring them down to a normal level, and puts away the excess (by releasing insulin), and shortly after your blood sugar levels will drop and you'll be hungry again. When you eat complex carbs, blood sugars stay stable as the sugar from the food is released slowly due slow digestion.
This is how diabetes type 2 occurs: by eating a high sugar, refined carb diet, your body becomes resistant to insulin. This is worsened by being overweight, although slim people can suffer from this too. It then becomes very difficult to lose weight. Treatment via diet is by actually giving a high carbohydrate diet - all complex, slowly digested carbs.
I hope this helps you understand the principle of "bad" vs. "good" carbs, so that at least you can make an informed decision on what to eat, and if you want to switch to low carb or not (see my answer to your other post). I recommend eating a whole range of healthy food so that you get your vitamins and essential nutrients.