Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/300.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
由于我的代码中有错误,visual c#无法加载表单!LoginDB.Designer.cs_C#_Visual Studio - Fatal编程技术网

由于我的代码中有错误,visual c#无法加载表单!LoginDB.Designer.cs

由于我的代码中有错误,visual c#无法加载表单!LoginDB.Designer.cs,c#,visual-studio,C#,Visual Studio,有一个错误,其中表示this.Load+=new System.EventHandler(this.LoginDB_Load) 错误是 错误CS1061“LoginDB”不包含“LoginDB_-Load”的定义,并且找不到接受“LoginDB”类型的第一个参数的可访问扩展方法“LoginDB_-Load”(是否缺少using指令或程序集引用?) 名称空间wavemaker { 部分类LoginDB { /// ///必需的设计器变量。 /// private System.Componen

有一个错误,其中表示
this.Load+=new System.EventHandler(this.LoginDB_Load)

错误是

错误CS1061“LoginDB”不包含“LoginDB_-Load”的定义,并且找不到接受“LoginDB”类型的第一个参数的可访问扩展方法“LoginDB_-Load”(是否缺少using指令或程序集引用?)

名称空间wavemaker
{
部分类LoginDB
{
/// 
///必需的设计器变量。
/// 
private System.ComponentModel.IContainer components=null;
/// 
///清理所有正在使用的资源。
/// 
///如果应释放托管资源,则为true;否则为false。
受保护的覆盖无效处置(布尔处置)
{
if(处理和(组件!=null))
{
组件。Dispose();
}
基地。处置(处置);
}
#区域Windows窗体设计器生成的代码
/// 
///设计器支持所需的方法-不修改
///此方法的内容与代码编辑器一起使用。
/// 
私有void InitializeComponent()
{
this.btn_Submit=new System.Windows.Forms.Button();
this.txt_UserName=new System.Windows.Forms.TextBox();
this.txt_Password=new System.Windows.Forms.TextBox();
this.label1=new System.Windows.Forms.Label();
this.label2=new System.Windows.Forms.Label();
这个.SuspendLayout();
// 
//btn_提交
// 
this.btn_Submit.Location=新系统图纸点(197,60);
this.btn_Submit.Name=“btn_Submit”;
this.btn_Submit.Size=新系统图尺寸(64,25);
this.btn_Submit.TabIndex=0;
this.btn_Submit.Text=“Login”;
this.btn_Submit.UseVisualStyleBackColor=true;
// 
//txt_用户名
// 
this.txt_UserName.Location=new System.Drawing.Point(67,8);
this.txt\u UserName=“txt\u UserName”;
this.txt_UserName.Size=新系统.Drawing.Size(194,20);
this.txt_UserName.TabIndex=1;
// 
//txt_密码
// 
this.txt_Password.Location=new System.Drawing.Point(67,34);
this.txt\u Password.Name=“txt\u Password”;
this.txt_Password.Size=新系统.Drawing.Size(194,20);
this.txt_Password.TabIndex=2;
// 
//标签1
// 
this.label1.AutoSize=true;
this.label1.Location=新系统图纸点(6,11);
this.label1.Name=“label1”;
this.label1.Size=新系统图纸尺寸(55,13);
this.label1.TabIndex=3;
this.label1.Text=“用户名”;
// 
//标签2
// 
this.label2.AutoSize=true;
this.label2.Location=新系统图纸点(6,37);
this.label2.Name=“label2”;
this.label2.Size=新系统图纸尺寸(53,13);
this.label2.TabIndex=4;
this.label2.Text=“密码”;
// 
//登录数据库
// 
此.AutoScaleDimensions=新系统.Drawing.SizeF(6F,13F);
this.AutoScaleMode=System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize=新系统.Drawing.Size(273,97);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.txt_密码);
this.Controls.Add(this.txt\u用户名);
this.Controls.Add(this.btn_Submit);
this.Name=“LoginDB”;
this.Text=“LoginDB”;
this.Load+=new System.EventHandler(this.LoginDB_Load);
此选项为.resume布局(false);
这个。执行布局();
}
#端区
private System.Windows.Forms.Button btn_Submit;
private System.Windows.Forms.TextBox txt_用户名;
private System.Windows.Forms.TextBox txt_密码;
private System.Windows.Forms.label1;
private System.Windows.Forms.label2;
}
}
删除此行:

this.Load += new System.EventHandler(this.LoginDB_Load);

然后双击控件“LoginDB”创建另一个。好的,代码中没有显示
LoginDB\u Load
方法,但这是一个分部类,因此可能有另一个文件中有
分部类LoginDB
。错误告诉您引用的方法不存在。你认为它应该存在吗?你在哪里定义的?如果您认为它不应该存在,为什么要引用它?它看起来像您的LoginDB.Designer.cs文件。
LoginDB\u Load
事件通常位于
LoginDB.cs
文件中,不会自动生成。您可以在designer视图中双击表单来创建它。否则,您需要先手动创建它,然后才能引用它。我猜您可能是无意中双击了设计器窗体,为它创建了一个加载事件,然后删除了新创建的事件方法,以为它会删除该事件。要修复此问题,请将该方法重新添加到代码中,以便再次加载设计器。右键单击表单->属性->事件工具栏图标->查找加载事件并清除/删除它。
this.Load += new System.EventHandler(this.LoginDB_Load);