How can I programmatically uncheck all rows in a DataGridViewCheckboxColumn in a datagridview?
I can get the correct value of the checkbox using
(bool)row.Cells[CheckBoxColumn.Index].FormattedValue
but that's only a getter.
I have tried setting the value of the cell using
(bool)row.Cells[CheckBoxColumn.Index].value = false
but that doesn't affect the FormattedValue.
How can I solve this?
You do sth. like:
(row.Cells[CheckBoxColumn.Index] as DataGridViewCheckBoxCell).value = false;
You just forgot to cast to the correct type, a generic DataGridViewCell
doesn't know its value-type.