Kottan
Kottan

Reputation: 5066

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 the application, the items are still missing! I have already restarted VS! Does anybody know, what the reason for this is?

Upvotes: 3

Views: 1728

Answers (3)

Dan Tao
Dan Tao

Reputation: 128367

  1. Did you possibly remove the call to InitializeComponent from your control's constructor by accident?

  2. Does the name of the partial class in your .designer.cs file match that of your "main" control file?

  3. 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.

Upvotes: 2

Iain Ward
Iain Ward

Reputation: 9936

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

Upvotes: 6

Mikael Engver
Mikael Engver

Reputation: 4768

Try to restart your Visual Studio, and the do a Rebuild Solution.

Upvotes: 0

Related Questions