My checkbox column doesn't respond when ticked, apparently it was set to read only, so changing state back to false aga开发者_Go百科in 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?
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;
}
精彩评论