我想取消选中动态生成的DataGridView中所有选中的CheckBox?
我试过跟随
for (int i = 0; i < MygridView.Rows.Count; i++)
{
DataGridViewCheckBoxCell cell = (DataGridViewCheckBoxCell)MygridView.Rows[i].Cells[0];
if (cell.Value == cell.TrueValue)
{
// (row.Cells[CheckBoxColumn.Index] as DataGridViewCheckBoxCell).value = false;
Need to unchecked all checked checkboxes
}
}
或者还有其他方法吗?
答案 0 :(得分:0)
试试这个:
foreach (DataGridViewRow item in MygridView)
{
DataGridViewCheckBoxCell cell = (DataGridViewCheckBoxCell)item.Cells[0];
cell.Value = false;
}