Eating corn is healthy and is good to eat when trying to lose weight as long as you eat the corn in moderation.
To really gain weight you'd have to eat a lot of corn for it to have an effect on your weight.
Corn contains 125 calories so it's not that much to be concerned about.
I eat corn all the time because I love corn and I never gain any weight from eating the corn.
Of course adding lots of butter to the corn could cause your calories to increase and cause more weight gain depending on your overall health.