我想检查datagridview中的“many”列是否为空。C#检查datagridview列是否为空
这里我的代码
for (int i = 0; i < (gridx.Rows.Count - 1); i++)
{
col = gridx.Rows[i].Cells["code"].Value.ToString();
col4 = gridx.Rows[i].Cells["many"].Value.ToString();
}
if (col4 == "")
{
MessageBox.Show("Many is empty");
this.Focus();
return;
}
else
{
//my code in here
}
,但它没有显示错误 “很多是空的”
前请
感谢
当您逐步进行调试时,'col4'的值是多少? – Dave
你想知道一个单元是空的还是全部单元?你有没有例外,你使用过调试器吗? –