title: I need to allow user to check only one checkbox in all three columns checkboxes added in datagridview C#
body: <p>I have a datagridview which i load from a datatable.
  i manually add three columns via DataGridViewCheckBoxCell class.
  Each row will be updated according to the checkbox checked by users.
  i am facing problem how to restrict user to select or check one checkbox from all the three available in the selected row in the loaded datagridview.</p>
  <p>The problem would be solved if there was an option of radio button adding in datagridview column or could i add a group of 3 radiobuttons as a column for each row.</p>
  <p><a href="https://i.stack.imgur.com/jIq6k.png" rel="nofollow noreferrer">This is what my datagrid looks like after adding 3 datagridviewcheckboxCells</a></p>
  <p>My code snippet of adding columns is</p>
  <pre><code>if (DG.DataSource != null)
                  {
                      DataGridViewCheckBoxColumn ChbColReceived = new DataGridViewCheckBoxColumn();
                      DataGridViewCheckBoxColumn ChbColCancelled = new DataGridViewCheckBoxColumn();
                      DataGridViewCheckBoxColumn ChbColStop = new DataGridViewCheckBoxColumn();
                      DG.Columns.Add(ChbColReceived);
                      DG.Columns.Add(ChbColCancelled);
                      DG.Columns.Add(ChbColStop);
                      ChbColReceived.HeaderText = &quot;Received&quot;;
                      ChbColCancelled.HeaderText = &quot;Cancelled&quot;;
                      ChbColStop.HeaderText = &quot;Stopped&quot;;
                  }
  </code></pre>
  <h2>Your suggestion will be appreciable.
  Regards</h2>
  <p><em><strong>Solution:</strong></em>
  Thanks to all devs/Gurus who helped me out. Special thanks to @JohnG whos answer is ticked as well. I have changed it a bit that may be acceptable for the person who answered. Here is my code which have solved my problem.</p>
  <pre><code>private void DG_CurrentCellDirtyStateChanged(object sender, EventArgs e)
          {
              try
              {
                  int colIndex = DG.CurrentCell.ColumnIndex;
                  int rowIndex = DG.CurrentCell.RowIndex;
                  bool currentValue;
                  if (DG.Columns[colIndex].Index == 11 || DG.Columns[colIndex].Index == 12 || DG.Columns[colIndex].Index == 13)
                  {
                      DG.CurrentCellDirtyStateChanged -= new EventHandler(DG_CurrentCellDirtyStateChanged);
                      currentValue = !(bool)DG.Rows[rowIndex].Cells[colIndex].FormattedValue;
                      switch (DG.Columns[colIndex].Index)
                      {
                          case 11:
                              if (currentValue == true)
                              {
                                  DG.Rows[rowIndex].Cells[12].Value = false;
                                  DG.Rows[rowIndex].Cells[13].Value = false;
                              }
                              break;
                          case 12:
                              if (currentValue == true)
                              {
                                  DG.Rows[rowIndex].Cells[11].Value = false;
                                  DG.Rows[rowIndex].Cells[13].Value = false;
                              }
                              break;
                          case 13:
                              if (currentValue == true)
                              {
                                  DG.Rows[rowIndex].Cells[11].Value = false;
                                  DG.Rows[rowIndex].Cells[12].Value = false;
                              }
                              break;
                      }
                      DG.CommitEdit(DataGridViewDataErrorContexts.Commit);
                      DG.CurrentCellDirtyStateChanged += new EventHandler(DG_CurrentCellDirtyStateChanged);
                  }
              }
              catch (Exception) { throw; }
          }
  </code></pre>
  <p>The Col[11],Col[12],col[13] are my target checkboxed columns.
  Thanks @JohnG for your time and concern.</p>