Chocolate is quite high in calories, which is why it is easy to put on weight after eating it. Also it is high in fat ...
You can put on weight eating chocolate or any other food for that matter...
It is just more likely that you will put on weight if the food is more calorie dense.
You see, its all calories in vs calories out...
You could get fat eating nothing but fruits and vegetables, or you could get fat eating chocolate and pizza...its just that you'd have to eat a whole lot more fruits and veggies to get fat then you would chocolate and pizza.
Here's a formula for you:
Maintenance calories = Bodyweight in lbs x 15
So if you weigh 150 pounds, that's: 150 x 15 = 2,250 calories/day.
If you weigh 150 pounds and you eat 500 calories over this every day for 1 week, you will gain 1 pound (3,500 calories = 1 pound).
So bottom line is to just watch what you eat, count your calories if you're worried about putting on weight and eat sensibly.
If you eat a bite here and there along with a well portioned healthy diet, no. If you over indulge, yes.