最简单的if语句出错了,不知道为什么
if (dataGridView1.CurrentRow.Cells[0].Value == null )
{
MessageBox.Show("导体没有数据,不能保存");
return;
}
这样子在运行的时候是没有问题的,但是我改成下面代码
if (dataGridView1.CurrentRow.Cells[0].Value == null && dataGridView2.CurrentRow.Cells[0].Value == null)
{
MessageBox.Show("导体没有数据,不能保存");
return;
}
就报错了,提示居然是 未将对象引用设置到对象的实例,不知道为什么.