Solve "Visual Studio requires the designer to use the first class in the file. Move the class code to make it the first class in the file, and then try to reload the designer ." Method

Source: Internet
Author: User

The error message is as follows:
Class treemenuview can be designed, but it is not the first class in the file. Visual Studio requires the designer to use the first class in the file. Move the class code to make it the first class in the file, and then try to reload the designer.
Hide

In system. componentmodel. Design. serialization. codedomdesignerloader. ensuredocument (idesignerserializationmanager Manager)
In system. componentmodel. Design. serialization. codedomdesignerloader. Duplicate mload (idesignerserializationmanager Manager)
In Microsoft. visualstudio. Design. serialization. codedom. vscodedomdesignerloader. receivmload (idesignerserializationmanager serializationmanager)
In system. componentmodel. Design. serialization. basicdesignerloader. beginload (idesignerloaderhost host)

Cause:
The error code is as follows:


Correct code: for example, (replace the bits of the two methods to be OK)

After comparison, you will find that the only difference between the two code segments is that the two classes are in the opposite position. In this case, it may be concluded that for vs.2005, for programming convenience, the post-code of treemodulview is put into two files with the keyword partial. The two files are a whole and a class. Therefore, vs.2005 automatically matches the treemodulview when loading the Form Designer. the first class in the CS form, so if you occupy the position of the first class, vs.2005 will match it when loading the Form Designer, because they do not match, so the above errors will occur.
Some people say this may be a bug in vs2005. for developers, pay attention to it.

Related Article

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.