views:

126

answers:

1

My checkbox column doesn't respond when ticked, apparently it was set to read only, so changing state back to false again will make it possible to tick. However, that will turn the whole edit mode to true. I tried to set edit mode to programatically while setting ReadOnly mode to false, but that will disable the checkbox back again.

How can I disable edit mode on all cells except checkbox column?

+2  A: 

You could prevent editing with the CellBeginEdit event if the cell isn't in the right column. For example, if the checkbox is in the first column:

private void dataGridView1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) {
  if (e.ColumnIndex != 0) e.Cancel = true;
}
Hans Passant