title: Programatically loop through a DatagridView and check checkboxes
body: <p>I have DataGridView bound by a datatable i have checkboxes to the same.</p>
  
  <p>I want to navigate or loop through the the datagridview and check mark these checkboxes ,Below is the syntax i use .</p>
  
  <pre><code>foreach(DataGridViewRow dr in dgvColumns.Rows)
  {
      DataGridViewCheckBoxCell checkCell =
          (DataGridViewCheckBoxCell)dr.Cells["CheckBoxes"];
      checkCell.Value=1;
      //Also tried checkCell.Selected=true;
      //Nothing seems to have worked.!
  }
  </code></pre>