No, you rather need to get an instance of a
CheckBox
and handle the event
CheckBox.CheckedChanged
:
http://msdn.microsoft.com/en-us/library/system.windows.forms.checkbox.checkedchanged.aspx[
^].
To get a control (to add an event handler to the invocation list of its event instance, as in your case):
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.editingcontrol.aspx.
[EDIT]
Okay, as some delicate moment is involved, I'll show you what to do:
void SetupGridViewEditEvents(DataGridView gridView) {
gridView.CellValueChanged += (sender, eventArgs) => {
DataGridViewCell cell = gridView.Rows[eventArgs.RowIndex].Cells[eventArgs.ColumnIndex];
DataGridViewCheckBoxCell checkBoxCell = cell as DataGridViewCheckBoxCell;
if (checkBoxCell != null) {
CheckState state = (CheckState)checkBoxCell.Value;
HandleCellCheckBoxCheckedChanged(
eventArgs.RowIndex,
eventArgs.ColumnIndex,
state);
}
};
}
void HandleCellCheckBoxCheckedChanged(int cellRow, int cellColumn, CheckState state) {
}
[EDIT]
Code sample fixed on 3/28/2013. Sorry for the inconvenience.
—SA