我是初学者,现在还是一头雾水呢
谢谢大家帮忙 阿
未处理的“System.NullReferenceException”类型的异常出现在 WindowsApplication6.exe 中。
其他信息: 未将对象引用设置到对象的实例。
private void InitializeComponent() { this.label1 = new System.Windows.Forms.Label(); this.textBox2 = new System.Windows.Forms.TextBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.button1 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // label1 // this.label1.Location = new System.Drawing.Point(8, 40); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(64, 16); this.label1.TabIndex = 0; this.label1.Text = "学号"; // // textBox2 // this.textBox2.Location = new System.Drawing.Point(88, 40); this.textBox2.Name = "textBox2"; this.textBox2.Size = new System.Drawing.Size(104, 21); this.textBox2.TabIndex = 1; this.textBox2.Text = ""; // // groupBox1 // this.groupBox1.Location = new System.Drawing.Point(48, 104); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(192, 120); this.groupBox1.TabIndex = 2; this.groupBox1.TabStop = false; this.groupBox1.Text = "frm"; // // button1 // this.button1.Location = new System.Drawing.Point(104, 80); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(80, 16); this.button1.TabIndex = 3; this.button1.Text = "click me!"; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.ClientSize = new System.Drawing.Size(292, 333); this.Controls.Add(this.button1); this.Controls.Add(this.groupBox1); this.Controls.Add(this.textBox2); this.Controls.Add(this.label1); this.Name = "Form1"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Load += new System.EventHandler(this.Form1_Load); this.ResumeLayout(false);
}
static int Main(string[] args) { Application.Run(new Form1()); return 0; }
private void button1_Click(object sender, EventArgs evargs) { //textBox2.Text ="click me!"; MessageBox.Show ("hello"); }
private void Form1_Load(object sender, System.EventArgs e) { } }
未处理的“System.NullReferenceException”类型的异常出现在 WindowsApplication6.exe 中。其他信息: 未将对象引用设置到对象的实例。