title: C# Populate DataGrid having ComboBox, CheckBox and TextBox
body: <p>I've got a DataGrid with 6 columns:
  ComboBox;ComboBox;CheckBox;CheckBox;CheckBox;TextBox</p>
  
  <p>I'm trying to populate this DataGrid with values I'm keeping in List of GridLine objects</p>
  
  <pre><code>    public class GridLine
      {
       public string sColumnA { get; set; }
       public bool bError { get; set; }
       public string sColumnB { get; set; }
       public bool bNullableB { get; set; }
       public bool bCollateB { get; set; }
       public bool bStaticB { get; set; }
       public string sStaticB { get; set; }
       (...)
      }
  </code></pre>
  
  <p>I've wrote a function that is setting DataGrid last line params and add new line but it is not working correctly - I'm getting only ComboBoxes on last line properly set, anything else:</p>
  
  <pre><code>        private void AddLine(GridLine gl)
      {
          DataGridViewComboBoxCell cellMs = (DataGridViewComboBoxCell)this.Rows[this.Rows.Count - 1].Cells[0];
          DataGridViewComboBoxCell cellOra = (DataGridViewComboBoxCell)this.Rows[this.Rows.Count - 1].Cells[1];
          DataGridViewCheckBoxCell cellNull = (DataGridViewCheckBoxCell)this.Rows[this.Rows.Count - 1].Cells[2];
          DataGridViewCheckBoxCell cellColl = (DataGridViewCheckBoxCell)this.Rows[this.Rows.Count - 1].Cells[3];
          DataGridViewCheckBoxCell cellStat = (DataGridViewCheckBoxCell)this.Rows[this.Rows.Count - 1].Cells[4];
          DataGridViewTextBoxCell cellStatText = (DataGridViewTextBoxCell)this.Rows[this.Rows.Count - 1].Cells[5];
  
          cellMs.Value = gl.sColumnA;
          cellOra.Value = gl.sColumnB;
          cellNull.Selected = gl.bNullableB;
          cellColl.Selected = gl.bCollateB;
          cellStat.Selected = gl.bStaticB;
          cellStatText.Value = gl.sStaticB;
  
          this.Rows.Add();
      }
  </code></pre>
  
  <p>I have no idea what I'm doing wrong.</p>
  
  <p>Many thanks</p>