title: C# - Fill a combobox in a datagridview using SQL Source
body: <p>I've seen some other articles on this, but perhaps I am doing something wrong. I'm using Visual Studio, C#, and this datagridview is using columns that are pre-defined in Visual Studio (not coded, used the GUI). That may even be part of the problem, as when I try to load the DGV, I get extra columns. Below is my code, and when populating the DGV, I just get extra columns that don't have the drop down option. How can I populate multiple rows into this DGV with drop down entries in cells that are specifically drop downs? I am trying to prevent doing a massive nested for loop in order to do these one by one if possible, as I anticipate up to 20K lines in this DGV (which I may reduce through other means, I just haven't gotten there yet).</p>
  
  <pre><code>private void ReadSQL(string query, DataGridView grid){
          try{
              string connectionString = "Server=SERVERNAME;Database=DATABASENAME;Persist Security Info=True;";
              dataAdapter = new SqlDataAdapter(query, connectionString);
              SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter);
              DataTable table = new DataTable();
              table.Locale = System.Globalization.CultureInfo.InvariantCulture;
              dataAdapter.Fill(table);
  
              bindingSource1.DataSource = table;
              //I expect something needs to happen here, not the line above.
  
              grid.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader);
              grid.RowHeadersVisible = false;
              grid.EnableHeadersVisualStyles = false;
              grid.ColumnHeadersDefaultCellStyle.BackColor = Color.DimGray;
              grid.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
              grid.GridColor = Color.RoyalBlue;
              for(int i = 0 ;  i &lt; grid.Columns.Count; i++){
                  grid.Columns[i].Width = (grid.Size.Width / grid.Columns.Count) - 1;
              }
          }catch(SqlException ex){
              MessageBox.Show("SQL ERROR: " + ex.ToString());
              MessageBox.Show(query);
          }
      }
  </code></pre>