遇到错误变量<变量名称>或者是未声明或从未分配变量、或者是、从未、分配

2023-09-03 17:27:41 作者:班上最淫荡的就是班长

我实现的WinForms C#中的大单与Visual Studio 2008。 后工作正常,因为它开始呈现出许多错误masseges作为标题,当我尝试打开设计的对话框的一个很大的部分。

I implement a big form in winforms C# with Visual Studio 2008. after working fine for a big portion of the dialog it start showing a lot of error masseges as in the title when I try to open the designer.

的变量或者是未声明或从未分配

"The variable is either undeclared or was never assigned"

我得到这个对于很多控件之前正常工作。 我认为这与自定义的控制情况,我用

I got this for a lot of controls that worked fine before. I think it happens with custom control that I use

推荐答案

首先推荐的是不要使用任何复杂的逻辑形式的构造,但在窗体的< STRONG> Load事件(在onload方法或重写)。

First recommendation is do not use any complicated logic in the form constructor, but in the form's Load event(or overrides of the OnLoad method).

设计者采用构造的code显示表单,如果你有错误,你的表格会在VS设计师成为不可。

The designer uses the code of constructor to display the form, and if you have errors your form will be "undisplayable" in the VS designer.

其次,每次你在设计问题时,关闭它并重建窗体的项目。验证错误列表窗口中的错误和警告。固定后,在DESIG模式重新打开表单。

Secondly, every time you have problems in the designer, close it and rebuild your form's project. Verify the errors and warnings in the error list Window. After fixing it, reopen your form in desig mode.