【发布时间】:2011-11-24 10:02:11
【问题描述】:
我正在尝试检查 datagridview 单元格中是否有空值和空值...但我做不到...
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
if ((String)dataGridView1.Rows[i].Cells[3].Value == String.Empty)
{
MessageBox.Show(" cell is empty");
return;
}
if ((String)dataGridView1.Rows[i].Cells[3].Value == "")
{
MessageBox.Show("cell in empty");
return ;
}
}
我什至试过这个代码
if (String.IsNullOrEmpty(dataGridView1.Rows[i].Cells[3].Value))
{
MessageBox.Show("cell is empty");
return;
}
谁能帮帮我..这个...
【问题讨论】:
-
你能告诉我你得到的错误信息是什么
-
对于空/空检查使用
string.IsNullOrEmpty() -
它没有显示任何错误消息,即使..我将单元格留空...
标签: c# winforms datagridview