Start New Discussion within our Software Development Community

I have a datagridview with two checkboxes and one label. The datagridview is unbound.
When the user checks on a checkbox, I want the box to be checked or unchecked as appropriate. Also, when a use clicks on the label, I want to be able to check the second check box.
I've tried to just check the status of the checkboxes after the user has clicked on them, but I always get the status as unchecked.
I've also tried to add code to check/uncheck them myself, but I have not been able to get the working either.

Here is some sample code:

this.cameraList.BeginEdit(true);
           this.cameraList.Rows[e.RowIndex].Cells[index].Value = CheckState.Unchecked;
           this.cameraList.CurrentCell = cameraList[2, e.RowIndex];
           this.cameraList.EndEdit()

But even after executing this, the checkbox remains checked.

It seems to work if I click on the label, the boxes will check and uncheck. But if I click on the checkboxes themselves it does not work.

Anyway, I am getting frustrated with the whole thing. Any help would be greatly appreciated.

I just set up an unbound DataGridVeiw with three columns as you describe.
The CheckBoxes are checked/unchecked by the user with out any problem.
Are you sure you have allowed user edits.
Check the ReadOnly status of the columns.:?:
Note: When you uncheck the "Enable Editing" on the DataGridView Task list (little white arrow at top right) it set each column to ReadOnly!
Unfortunately, checking back on does not reset the ReadOnly properties.:confused:

This article has been dead for over six months. Start a new discussion instead.