title: how to change DataGridViewCheckBoxCell checked state by code
body: <pre><code>  foreach (DataGridViewRow dgvr in dataGridViewProductList.Rows)
                  {
                      string dgvrID = dgvr.Cells["ID"].Value.ToString();
                      DataRow[] s = DT.Select("BillID = " + dgvrID);
                      if (s.Length &gt; 0)
                      {
                          dataGridViewProductList.Columns["chk"].ReadOnly = false;
                          dataGridViewProductList.Rows[dgvr.Index].Cells["chk"].ReadOnly = false;
                           dataGridViewProductList.Rows[dgvr.Index].Cells["chk"].Value = 1;
          }
      }
  </code></pre>
  
  <p>after running code <code>DataGridViewCheckBoxCell</code> doesn't changed to checked, how can i  change its checked state</p>
  
  <p>i tried </p>
  
  <pre><code>DataGridViewCheckBoxCell cell = (DataGridViewCheckBoxCell)dataGridViewProductList.Rows[dgvr.Index].Cells["chk"];
                           cell.ReadOnly = false;
                          cell.TrueValue = true;
  
                          cell.Value = cell.TrueValue;
  </code></pre>
  
  <p>but doesn't work.</p>