code being written outside "windows form designer generated code"

tosberg

Member
Joined
May 29, 2003
Messages
7
Anybody ever have the problem where you add a control, say...a button, and the line "Friend WithEvents Button1 as Button" gets written outside of the "windows form designer generated code" region and at the bottom of the class? But the rest of the code that gets written for said Button1 does get written in the "windows form designer generated code" area? Anyone have any ideas how to fix this problem? Quite frustrating I must say.
 
when that happened to me I just cut & paste the line of code
back into the form generated code.

ailzaj
 
Continued...

I still want to know why this is happening and how to fix it. I realize I can cut and paste it back in.
 
I have 2002 also but have never had that problem. Although it is the standard version.

Hopefullly 2003 does not have the problem you are speaking of or any other for that matter!!
 
It only happened to me when I copied & pasted some code out of
MSDN help file to test it out, & added my own control to the
project, then the WithEvents code for the new control was
outside of the windows form code.

ailzaj
 
Sounds like a typical object declaration thats usually put at the top of the class when you add that specified control to the form. That code has always been placed outside of the Windows Generated Code region, although its usually above it, not below it.

Just copy it and paste it at the top of your class with the rest of the object declarations. *shrug*
 
Back
Top