I've recently noticed that the Visual Studio designer (I'm guessing it's called that) has been removing some of my method handles. Is there a way to stop designer from doing this?
An example of what I mean is this: I've got a method for when my MainForm closes called MainForm_Closing - basically a "Would you like to save changes?" prompt. Buried in my Main.designed.cs is the line:
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_Closing);
within the section relating to my MainForm object.
But if I make any visual changes to my MainForm (dragging a control onto it, editing a label name, changing an image property, etc.) it seems that the part of Visual Studio that creates the designer wipes out my custom code.
I'm guessing that the designer is called to create the designer.cs at compile time (so that it can easily compile to IL), and therefore removes my custom handles as a matter of course.
BTW: I'm generating my custom handles are being created with the help of IntelliSense. For example I type:
this.FormClosing +=
and IntelliSense suggests the correct handle and says "press TAB to insert").
Any help understanding this (and stopping Visual Studio from removing my handles) would be much appreciated.