C# 怎样判断 datagridview 中的checkbox列是否被选中

时间:2023-12-26 15:38:49
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{

for (int i = 0; i < dataGridView1.Rows.Count; i++)

{

  if ((bool)dataGridView1.Rows[i].Cells[0].EditedFormattedValue==true) //之前用value,值一直不变,改为EditedFormattedValue可以了

{

//TODO

  }

}

}

上面事件和里面方法可能不匹配,是找的结合到一起的,但不影响看