. Net advantages and disadvantages (depressed for a day)

Source: Internet
Author: User
. 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 ();
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.