My datagridview has 2 columns. Column 0 has contains checkboxes in the off position (default). The user can click the box and change the state or Checked.
How can I loop thru and find the ones that are checked. Here is my code
try
{
// This line will cause InvalidCastException
// Specified cast is not valid.
if ((bool)(row.Cells[0]).Value || (CheckState)row.Cells[0].Value == CheckState.Checked)
{
// Do something
MessageBox.Show("Checked");
}
}
catch (NullReferenceException nre)
{
MessageBox.Show("No Rows Have Been Checked");
}