InitializeComponent code lost

  • Thread starter Thread starter Tabo
  • Start date Start date
T

Tabo

when i build the project using C#, the code in
InitializeComponent lost sometimes. Is it a bug?? if yes,
can some method fix it? thanks for help.

Tabo
 
The problem here is this. If you add your own code to the
InitializeComponent and then add a new control to your form or delete a
control from your form, then your code may become deleted. Microsoft
actually warns about it and does not recommend to add your own code to the
InitializeComponent. That's why there is a comment added to it:
/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary


You'll be better off adding your code to the constructor. So, it's not a
bug, it's a feature.
 
I don't know about Tabo's problem, but I loose *all* code in
InitializeComponent *very* regularly.
After I make a change to my .aspx page (in html source view), this method is
wiped out *completely* by my VS.Net 2003. Everything's gone: event handlers,
property initialisation, everything, InitalizeComponent is completely
empty...

This is driving me mad. I regularly save the contents of InitializeComponent
in a separate file, so I can copy and paste it whenever needed (which
happens to be several times a day)...
I had this in the original VS.Net, and the 'feature' is still there in
VS.Net 2003...

Luc K
 
Back
Top