简体   繁体   中英

Cannot load user control design view in Visual Studio 2019

This is very strange. I have a custom UserControl called UIControl. That user control has another custom control (derived from Label control).

This worked OK for long time. Both at design time and at run time. However, now, I needed to edit that custom UIControl but the Visual Studio 2019 shows this error message:

Visual Studio 设计视图

This error means that the RealTime.DigitalClock is not found. As you see in the project, that control is not part of an external assembly, but the same assembly where UIControl is.

I have compiled and recompiled thousand of times and compilations finish perfectly. Even the application runs.

Furthermore, when I build the project, those user controls appear in tool box, but when I try to place it in any form, an error telling that the component could not be added and it will be removed from the tool box is shown.

I don't really know what is happening here. I have even closed and re-open VS 2019 but no avail.

Regards Jaime

According to To prevent possible data loss in windows form c# , I suggest that you can do as the following steps.

First, Please find all the RealTime.DigitalClock related code in UIControl.designer and UIControl.cs.

Second, you can delete the above code.

Third, you need to rewrite the code you just deleted.

Finally, rebuild it and check if it works for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM