Hi everyone.
I'm having a really annoying problem I can't solve and couldn't find an answer to anywhere, let's see if you got what it takes.
I have a dataGridView on a C# Windows Form. Unbound. I fill in rows with a button.
I have a checkbox column which isn't read-only (unlike the other columns) so the user could check whatever row he wants.
All I simply want is to know (on CellContentClic k) if the checkbox is checked or not!
I do this for now:
It works for every other cell, but when clicking a checkbox, it fails and returns:
"Object reference not set to an instance of an object."
Why? Because the .Value = null.
Please please help!
Thanks alot in advance,
Ben.
I'm having a really annoying problem I can't solve and couldn't find an answer to anywhere, let's see if you got what it takes.
I have a dataGridView on a C# Windows Form. Unbound. I fill in rows with a button.
I have a checkbox column which isn't read-only (unlike the other columns) so the user could check whatever row he wants.
All I simply want is to know (on CellContentClic k) if the checkbox is checked or not!
I do this for now:
Code:
private void dataGridView1_CellContentClick(object sender,DataGridViewCellEventArgs e)
{
MessageBox.Show(dataGridView1[e.ColumnIndex, e.RowIndex].Value.ToString());
}
"Object reference not set to an instance of an object."
Why? Because the .Value = null.
Please please help!
Thanks alot in advance,
Ben.
Comment