日期:2014-05-17  浏览次数:20660 次

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个条件语句完全一样啊,为什么不写在一起。。