if (e.ColumnIndex == 0) //column index { bool hasOtherCheckboxChecked = false; foreach (DataGridViewRow dgvr in dataGridView1.Rows) { DataGridViewCheckBoxCell cell = (DataGridViewCheckBoxCell)dgvr.Cells[e.ColumnIndex]; if (cell.Value == cell.TrueValue && dgvr.Index != e.RowIndex) { hasOtherCheckboxChecked = true; break; } } DataGridViewCheckBoxCell currentCell = (DataGridViewCheckBoxCell)dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex]; if (currentCell.Value == currentCell.TrueValue && hasOtherCheckboxChecked) { currentCell.Value = currentCell.FalseValue; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)