我已经查看过有关类似问题的其他问题,但据我所知,我的命名空间和表单名称是正确的,但仍然给我错误代码
Form1.Dispose(bool):找不到合适的方法来覆盖
除了form1.designer.cs和form1.cs中命名空间和表单的不同名称之外还有什么可以解决这个问题?
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.button2 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.textBox4 = new System.Windows.Forms.TextBox();
this.textBox5 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// button2
//
this.button2.Location = new System.Drawing.Point(22, 106);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(56, 20);
this.button2.TabIndex = 1;
this.button2.Text = "button2";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(123, 31);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(131, 20);
this.textBox1.TabIndex = 2;
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged_1);
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(123, 67);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(130, 20);
this.textBox2.TabIndex = 3;
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(123, 106);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(129, 20);
this.textBox3.TabIndex = 4;
this.textBox3.TextChanged += new System.EventHandler(this.textBox3_TextChanged_1);
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(23, 176);
this.textBox4.Multiline = true;
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(230, 71);
this.textBox4.TabIndex = 5;
this.textBox4.TextChanged += new System.EventHandler(this.textBox4_TextChanged_1);
//
// textBox5
//
this.textBox5.Location = new System.Drawing.Point(146, 149);
this.textBox5.Name = "textBox5";
this.textBox5.Size = new System.Drawing.Size(105, 20);
this.textBox5.TabIndex = 6;
this.textBox5.TextChanged += new System.EventHandler(this.textBox5_TextChanged);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 270);
this.Controls.Add(this.textBox5);
this.Controls.Add(this.textBox4);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button2);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button button2;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.TextBox textBox5;
}
答案 0 :(得分:0)
您的form1.cs
文件使Form1
成为嵌套类,可以WindowsFormsApplication3.Person.Form1
进行访问。这是因为您在 Person
的定义之后放置了Form1
的右括号。使用任何体面的编辑器代码格式化选项都应该明白这一点。
WindowsFormsApplication3.Person.Form1
与WindowsFormsApplication3.Form1
不匹配,因此后者从未见过基类。