. Net advantages and disadvantages (depressed for a day)
Today, when you rewrite the question editor,
I found Code Gone
(I performed paneledit = new panelclass in initializecomponent)
While my panelclass is a custom panel.
An error occurred while compiling the paneledit non-object case.
First, the code written by myself in initializecomponent has disappeared.
It took me an hour to find out the reason:. Net was clever enough to help you re-generate code based on the form element and delete the code I wrote.
Solution: (1) suitable for: (webform ). Defined as a method and called in oninit
(2) suitable for (winform): it is defined as a method and called in the constructor. Call the initializecomponent () method.
Eg:
Private void getpanleeidt ()
{
This. paneledit = new wordindotnet. panelclass ();
// Paneledit
This. paneledit. Anchor = (system. Windows. Forms. anchorstyles) (system. Windows. Forms. anchorstyles. Top | system. Windows. Forms. anchorstyles. Left)
| System. Windows. Forms. anchorstyles. Right )));
This. paneledit. backcolor = system. Drawing. systemcolors. activecaptiontext;
This. paneledit. diffnumber = 0;
This. paneledit. disp = NULL;
This. paneledit. Location = new system. Drawing. Point (136, 80 );
This. paneledit. Name = "paneledit ";
This. paneledit. size = new system. Drawing. Size (712,240 );
This. paneledit. tabindex = 26;
This. paneledit. testtype = NULL;
This. Controls. Add (this. paneledit );
}
// Constructor
Public frmmain ()
{
//
// Required for Windows Form Designer support
//
// Initial panleeidt
This. getpanleeidt ();
Initializecomponent ();
}