Hi gborgesbr,
The value of the cell would only be modified when the cell leaves. We can use the EditedFormattedValue property instead. This is the modified code snippet:
private void _collectorDataGridView_CellClick(object sender, DataGridViewCellEventArgs e) {
DataGridViewCheckBoxCell cell;
if (e.ColumnIndex == 0 && e.RowIndex > -1)
{
cell = (DataGridViewCheckBoxCell)_collectorDataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex];
//Change Value of Cell to EditedFormattedValue
if (cell.EditedFormattedValue == cell.TrueValue)
{
//Checked - It never goes here
currentActivity.collectorList.Add((collectorVo)_collectorDataGridView.Rows[e.RowIndex].Tag);
notList.Remove((collectorVo)_collectorDataGridView.Rows[e.RowIndex].Tag);
}
else
{
//Unchecked
currentActivity.collectorList.Remove((collectorVo)_collectorDataGridView.Rows[e.RowIndex].Tag);
notList.Add((collectorVo)_collectorDataGridView.Rows[e.RowIndex].Tag);
}
}
}
Let me know if this helps or not.
Aland Li
Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.