title: Get DataGridView checkbox cell value?
body: <p>I'm having a strange issue here.</p>
  
  <p>I have a 3  column datagrid that is filled by a connection with the database. So far so good.</p>
  
  <p>I have an extra column, of checkbox type. I need to get it's value for perfoming a bulk operation on it. Here is the catch:</p>
  
  <p>When all cells are selected, it works fine. But when an user selects any cell that its not the first, software gives me a object reference exception.</p>
  
  <p>Here is the code</p>
  
  <pre><code>public List&lt;String&gt; GetSelected()
  {
      List&lt;String&gt; selected = new List&lt;String&gt;();
      foreach(DataGridViewRow row in datagrid.rows)
      {
          if ((Boolean)row.Cells[wantedCell].Value == true)
          {
              selected.Add(row.Cells[anotherCell]);
          }
      }
  }
  </code></pre>
  
  <p>I tracked down the failure to the if-test, throwing a exception, because the value of the cell is read as null.</p>
  
  <p>Any thougths?</p>
  
  <p>Thanks</p>