Class XX 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

Source: Internet
Author: User

When I made a custom control today, I encountered a problem usingCodeWhen writing code to a file, there is no corresponding thing in the designer, but the following error message appears: Class XX 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.
At this time, the CS file icon in the vs resource manager will become installed.ProgramClass icon. However, you can right-click the menu and use "view code" to open it with vs. You can use Solution Explorer to browse the icon or "code file. CS icon, double-click in Solution Explorer. the CS file vs is opened normally. The above prompt is displayed. The specific reason is that for controls with a designer, the class where the control is located is the first. Finally, you only need to cut the XX class shown above to the top of the class in the code, save it once, and generate it again. The problem is solved.

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.