There is an answer to a question like this here, but my question is why doing this the code is not working so please don't mark it as a "duplicate" of that question
So I have a dataGridView and in it a checkbox. So I want something to happen when I check and uncheck this box so I do:
private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
Trace.WriteLine("Cell Content Click Col: " + e.ColumnIndex + " Row: " + e.RowIndex);
if(e.ColumnIndex==0) //0 is the column of the checkbox
{
Trace.WriteLine("Value:"+ dataGridView2.Rows[e.RowIndex].Cells[e.ColumnIndex].Value);
}
}
As you can see I am applying the answer of the other question. However the result is that no matter if I check or uncheck the box, the value is always false.
I am going to try this with CellValidating to see if I get better results, but what is the best way to check if a box is checked or unchekedon a dataGridView?