Using Nullable Types: boolean
<p>I have a checkbox in a column of a DataGridView. Right now I got an exception because there is no checkbox checked. I am not sure how to handle it?</p>

<pre><code> private void uncheckGrid(ref DataGridView dgv, int index)
    {
        try
        {
            foreach (DataGridViewRow row in dgv.Rows)
            {
                DataGridViewCheckBoxCell check = row.Cells[1] as DataGridViewCheckBoxCell;
                if (check.Value != null) // throw an exception here.
                {
                    if ((bool)check.Value)
                    {
                        Int32 intVal = Convert.ToInt32(row.Cells[0].Value);
                        if (intVal == index)
                        {
                            check.Value = false;
                        }
                    }
                }
            }
</code></pre>

<p>Thanks.</p>
