title: Populating ComboBoxDataColumn items and values
body: <p>I have a "populate combobox", and I'm so happy with it that I've even started using more comboboxes. It takes the combobox object by reference with the ID of the "value set" (or whatever you want to call it) from a table and adds the items and their respective values (which differ) and does the job.  </p>
  
  <p>I've recently had the brilliant idea of using comboboxes in a gridview, and I was happy to notice that it worked JUST LIKE a single combobox, but populating all the comboboxes in the given column at the same time.  </p>
  
  <pre><code>ObjComboBox.Items.Add("yadayada");
  //works just like
  ObjComboBoxColumn.Items.Add("blablabla");
  </code></pre>
  
  <p>But When I started planning how to populate these comboboxes I've noticed: There's no "Values" property in ComboBoxDataColumn.  </p>
  
  <pre><code>ObjComboBox.Values = whateverArray;
  //works, but the following doesn't
  ObjComboBoxColumn.Values = whateverArray;
  </code></pre>
  
  <p>Questions:<br>
  0 - How do I populate it's values ? (I suspect it's just as simple, but uses another name)<br>
  1 - If it works just like a combobox, what's the explanation for not having this attribute ?</p>
  
  <hr>
  
  <p>-----[EDIT]------</p>
  
  <p>So I've checked out Charles' quote, and I've figured I had to change my way of populating these bad boys. Instead of looping through the strings and inserting them one by one in the combobox, I should grab the fields I want to populate in a table, and set one column of the table as the "value", and other one as the "display". So I've done this:</p>
  
  <pre><code>ObjComboBoxColumn.DataSource = DTConfig; //Double checked, guaranteed to be populated
  
  ObjComboBoxColumn.ValueMember = "Code"; 
  ObjComboBoxColumn.DisplayMember = "Description";
  </code></pre>
  
  <p>But nothing happens, if I use the same object as so:</p>
  
  <p>ObjComboBoxColumn.Items.Add("StackOverflow");</p>
  
  <p>It is added. </p>
  
  <p>There is no DataBind() function.</p>
  
  <p>It finds the two columns, and that's guaranteed ("Code" and "Description") and if I change their names to nonexistant ones it gives me an exception, so that's a good sign.</p>
  
  <hr>
  
  <p>-----[EDIT]------</p>
  
  <p>I have a table in SQL Server that is something like</p>
  
  <p>code  |  text<br>
  —————<br>
     1    | foo<br>
     2    | bar    </p>
  
  <p>It's simple, and with other comboboxes (outside of gridviews) i've successfully populated looping through the rows and adding the texts:</p>
  
  <pre><code>ObjComboBox.Items.Add(MyDataTable.Rows[I]["MyColumnName"].ToString());
  </code></pre>
  
  <p>And getting every value, adding it into an array, and setting it like:</p>
  
  <pre><code>ObjComboBox.Values = MyArray;
  </code></pre>
  
  <p>I'd like to populate my comboboxColumns just as simply as I do with comboboxes.</p>