01.
02.
03.
void
dataGridView1_CurrentCellDirtyStateChanged(
object
sender,
04.
EventArgs e)
05.
{
06.
if
(dataGridView1.IsCurrentCellDirty)
07.
{
08.
dataGridView1.CommitEdit(DataGridViewDataErrorContexts.Commit);
09.
}
10.
}
11.
12.
13.
14.
public
void
dataGridView1_CellValueChanged(
object
sender,
15.
DataGridViewCellEventArgs e)
16.
{
17.
if
(dataGridView1.Columns[e.ColumnIndex].Name ==
"CheckBoxes"
)
18.
{
19.
DataGridViewDisableButtonCell buttonCell =
20.
(DataGridViewDisableButtonCell)dataGridView1.
21.
Rows[e.RowIndex].Cells[
"Buttons"
];
22.
23.
DataGridViewCheckBoxCell checkCell =
24.
(DataGridViewCheckBoxCell)dataGridView1.
25.
Rows[e.RowIndex].Cells[
"CheckBoxes"
];
26.
buttonCell.Enabled = !(Boolean)checkCell.Value;
27.
28.
dataGridView1.Invalidate();
29.
}
30.
}