Get value from DataGridViewCheckBoxCell
try:
DataGridViewCheckBoxCell chkchecking = roow.Cells[0] as DataGridViewCheckBoxCell;
if (Convert.ToBoolean(chkchecking.Value) == true)
{
}
or
DataGridViewCheckBoxCell chkchecking = roow.Cells[0] as DataGridViewCheckBoxCell;
if ((bool)chkchecking.Value == true)
{
}
Tried different options, same code sometimes worked and some other times it did not. Upon extensive debugging, it turned out that the root cause is not with the checkbox fetching code but the datagridvew mechanism itself.
The value of checkbox in the active/selected row was never received properly. If the datagridview has only one row, this issue can not be detected.
myDataGridViewName.EndEdit();
This has to be called before reading the cell values. After that the simple statements in the approved answer were enough.
Convert.ToBoolean(chkchecking.Value)
or
(bool)chkchecking.Value
both worked fine as expected. The credit for this tip goes to another answer to a similar question.