title: Populate datagridview combobox
body: <p>I have the following code on my windows form load:</p>
  
  <pre><code>    private void Panou_Load(object sender, EventArgs e)
      {
  
          List&lt;string&gt;[] list;
  
          //list in a array with all elements from a select query
          list = Conexiune.Select();
  
  
          dataGridView1.Rows.Clear();
  
          for (int i = 0; i &lt; list[0].Count; i++)
          {
              int number = dataGridView1.Rows.Add();
              dataGridView1.Rows[number].Cells[0].Value = list[0][i];
              dataGridView1.Rows[number].Cells[1].Value = list[1][i];
              dataGridView1.Rows[number].Cells[2].Value = list[2][i];
  
              dataGridView1.Rows[number].Cells[4].Value = list[4][i];
              dataGridView1.Rows[number].Cells[5].Value = list[5][i];
              dataGridView1.Rows[number].Cells[6].Value = list[6][i];
          }
      }
  </code></pre>
  
  <p>On my datagridview the 4th cell is a combobox. How can I populate the combobox with the value from my select (list[3][i] variable)?</p>
  
  <p><strong>UPDATE 1:</strong></p>
  
  <pre><code>    private void Panou_Load(object sender, EventArgs e)
      {
  
          List&lt;string&gt;[] list;
  
          list = Conexiune.Select();
          dataGridView1.Rows.Clear();
  
  
          for (int i = 0; i &lt; list[0].Count; i++)
          {
              int number = dataGridView1.Rows.Add();
              dataGridView1.Rows[number].Cells[0].Value = list[0][i];
              dataGridView1.Rows[number].Cells[1].Value = list[1][i];
              dataGridView1.Rows[number].Cells[2].Value = list[2][i];
              (dataGridView1.Columns[3] as DataGridViewComboBoxColumn).DataSource = new List&lt;string&gt; { list[3][i] };
              dataGridView1.Rows[number].Cells[4].Value = list[4][i];
              dataGridView1.Rows[number].Cells[5].Value = list[5][i];
              dataGridView1.Rows[number].Cells[6].Value = list[6][i];
          }
      }
  </code></pre>
  
  <p><a href="http://i.stack.imgur.com/0WLDr.jpg" rel="nofollow">http://i.stack.imgur.com/0WLDr.jpg</a></p>
  
  <p><strong>UPDATE 2:</strong></p>
  
  <pre><code>    private void Panou_Load(object sender, EventArgs e)
      {
  
          List&lt;string&gt;[] list;
  
          list = Conexiune.Select();
          dataGridView1.Rows.Clear();
  
          (dataGridView1.Columns[3] as DataGridViewComboBoxColumn).DataSource = new List&lt;string&gt; { "", "activ", "inactiv", "neverificat" };
  
          for (int i = 0; i &lt; list[0].Count; i++)
          {
              int number = dataGridView1.Rows.Add();
              dataGridView1.Rows[number].Cells[0].Value = list[0][i];
              dataGridView1.Rows[number].Cells[1].Value = list[1][i];
              dataGridView1.Rows[number].Cells[2].Value = list[2][i];
              dataGridView1.Rows[number].Cells[3].Value = list[3][i];
              dataGridView1.Rows[number].Cells[4].Value = list[4][i];
              dataGridView1.Rows[number].Cells[5].Value = list[5][i];
              dataGridView1.Rows[number].Cells[6].Value = list[6][i];
          }
      }
  </code></pre>
  
  <p><a href="http://i.stack.imgur.com/MlnER.jpg" rel="nofollow">http://i.stack.imgur.com/MlnER.jpg</a></p>