Winforms usercontrol phenomenon : suddenly all items are away!
I have a winform usercontrol with several items (textboxes, buttons,...). Now I am confronted with phenomenon, that all items are suddenly away (in the VS 2010 designer view / document outline), although in the control designer file (designer.cs) the textboxes, buttons,... are still defined. There is also no compilation error. When I run 开发者_JAVA技巧the application, the items are still missing! I have already restarted VS! Does anybody know, what the reason for this is?
In the InitializeComponent method do all the controls get added to the form via this.Controls.Add... statements?
I know this happened with VS2003 a lot that these code lines would disappear. I suspect that this is the problem
Did you possibly remove the call to
InitializeComponent
from your control's constructor by accident?Does the name of the
partial class
in your .designer.cs file match that of your "main" control file?Try running your application through VS's debugger. Put a breakpoint at
InitializeComponent
and step through all the code responsible for creating and placing all the controls in your user control. Maybe you will happen upon an explanation this way.
Try to restart your Visual Studio, and the do a Rebuild Solution.
精彩评论