for (int i = 0; i < this .dataGridView1 .Rows .Count ;i++ )
{
if (this.textBox.Text != this.dataGridView1.Rows[i].Cells[0].Value.ToString ())
{
}
}
这样写不知道为什么出错,提示说 《未将对象引用设置到对象的实例。。》
请问该怎么解决呢?谢谢!
{
if (this.textBox.Text != this.dataGridView1.Rows[i].Cells[0].Value.ToString ())
{
}
}
这样写不知道为什么出错,提示说 《未将对象引用设置到对象的实例。。》
请问该怎么解决呢?谢谢!
Equals(this.dataGridView1.Rows[i].Cells[0].Value.ToString())
for (int i = 0; i < this .dataGridView1 .Rows .Count ;i++ )
改成
for (int i = 0; i < this .dataGridView1 .Rows .Count - 1 ;i++ )
也行
{
if (Equals(this.dataGridView1.Rows[i].Cells[0].Value.ToString().Trim(), this.textBox.Text.ToString().Trim()) == false)
{
------------
}
}