读书人

this.comboBox1.Text = ? 疏失

发布时间: 2012-10-28 09:54:44 作者: rapoo

this.comboBox1.Text = ? 出错

string kname="OK";

if (LableNode.ChildNodes[0].InnerText == "0")//条件1
{
this.comboBox1.Text = Kname;//正常
this.textBox1.Text = tx2;
}
if (this.comboBox1.Text == "")//条件2
{
this.comboBox1.Text = Kname;//出错,“未将对象引用设置到对象实例”
this.textBox1.Text = tx2;
}

这里很奇怪,以前编译没出现问题,今天这里出错了。

[解决办法]
一般这种错误。 自己设置断点调试下就好了。
[解决办法]
2个条件语句完全一样啊,为什么不写在一起。。

读书人网 >C#

热点推荐