WinForm设计器打开设计器时出错

发布于 2024-09-30 09:16:29 字数 342 浏览 8 评论 0原文

我在 VS 2010 .net 4.0 上工作,我的应用程序有 winForm 和许多控件。 有时我会出现非常奇怪的设计器错误:

找不到类型“Namespace.TypeName”。请确保引用包含此类型的程序集。如果此类型是您的开发项目的一部分,请确保该项目已成功构建。 变量“ControlName”未声明或从未分配。

我单击“忽略并继续”,控件从我的表单中消失。 如果我查看Designer.cs,控件是存在的..

我读到了:链接文本,但它在vs2003中,我不能成功解决这个问题..

谢谢..

I work on VS 2010 .net 4.0 , my app had winForm with many controls.
sometime i occur very starnge designer error:

Could not find type 'Namespace.TypeName'. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built.
The variable 'ControlName' is either undeclared or was never assigned.

i click Ignore and Continue the control disappear from my form.
if i look in designer.cs the controls are exists..

I read this : link text but it is in vs2003 and i can not sucess solve this problem..

Thanks..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不再让梦枯萎 2024-10-07 09:16:29

此问题可能由多种方式引起,通常是由以下自定义控件/组件引起:

  • 没有默认构造函数
  • 依赖于运行时设置的变量(单例实例、数据源等)
  • 无法编译(您可以在设计器中成功编译之前不要使用控件)
  • 自从将它们添加到表单以来已经进行了重大更改/重写

它也可能由于 Visual Studio 中的故障而发生 - 这种情况很少见,但通常可以修复通过清理和重建您的解决方案和/或重新启动 IDE。

This problem can be caused in a number of ways, usually by custom controls/components that:

  • Do not have a default constructor
  • Depend on variables that are set at run-time (singleton instances, data sources, etc)
  • Fail to compile (you can't use a control in the designer until it compiles successfully)
  • Have been significantly changed/rewritten since they were added to the form

It can also happen as a result of a glitch in Visual Studio - this is much rarer, but can usually be fixed by cleaning and rebuilding your solution and/or restarting the IDE.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文