110,570
社区成员
发帖
与我相关
我的任务
分享
if (string.isNullOrEmpty(Convert.toString(dataGridView1.CurrentRow.Cells[0].Value)))
{
MessageBox.Show("还好");
}
string.isNullOrEmpty代替你的=="";
bool isSel = false;
int rowcount = 0;
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
if (Convert.ToString(dataGridView1.Rows[i].Cells[1].Value) != null && Convert.ToString(dataGridView1.Rows[i].Cells[0].Value) != null)
{
isSel = Convert.ToBoolean(dataGridView1.Rows[i].Cells[0].Value);
if (isSel)
{
rowcount++;
strarr = new string[rowcount];
}
for (int j = 0; j < rowcount; j++)
{
if (Convert.ToString(dataGridView1.Rows[j].Cells[1].Value) == null)
{
//在此处理
strarr[j] = dataGridView1.Rows[j].Cells[1].Value.ToString();
}
}
}
}