标题:“System.NullReferenceException
取消只看楼主
in羊羊
Rank: 1
等 级:新手上路
帖 子:144
专家分:0
注 册:2005-4-17
 问题点数:0 回复次数:2 
“System.NullReferenceException
代码好像没什么问题,运行时就是这样的提示
我是初学者,现在还是一头雾水呢
谢谢大家帮忙 阿
搜索更多相关主题的帖子: System 一头雾水 提示 代码 
2005-08-03 16:38
in羊羊
Rank: 1
等 级:新手上路
帖 子:144
专家分:0
注 册:2005-4-17
得分:0 

未处理的“System.NullReferenceException”类型的异常出现在 WindowsApplication6.exe 中。

其他信息: 未将对象引用设置到对象的实例。

2005-08-03 16:40
in羊羊
Rank: 1
等 级:新手上路
帖 子:144
专家分:0
注 册:2005-4-17
得分:0 

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 中。其他信息: 未将对象引用设置到对象的实例。

2005-08-05 10:19



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-24275-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.139287 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved