title: Convert text column to combobox column in an object bound DataGridView control
body: <p>I have a class called Contacts which contains  a collection of objects called <code>PhoneNumbers</code>. Each <code>PhoneNumbers</code> object has several properties including <code>PhoneNumber</code> and <code>PhoneType</code> as well as the foreign key <code>PhoneTypeFK</code>. I assign this collection to a DataGridView control’s DataSource and hide the columns (properties) I don’t want to see in the DGV. This creates a bunch of text cells (rows/cols)  in the DGV being for the Phone Number and the Type. All well and good except, I want a combobox to be shown in the Phone Type column populated with all the various Phone Types of the <code>PhoneTypes</code> Table with the appropriate Phone Type shown in the cell for that Phone Number.<br>
  I read somewhere that I need to add a combobox column at design time with the same <code>DataPropertyName</code> as the Property of the <code>PhoneNumbers</code> Object, i.e. <code>PhoneType</code> so that when the DGV is populated with columns it will use this column instead of creating a new one (for the PhoneType). I cannot, however, get this to work. 
  I used the code below to populate the DGV and hide the irrelevant columns:</p>
  
  <pre><code>//Fill Grid
  uxContactPhoneNumbersGrd.DataSource = contacts.PhoneNumbers;
  
  //Hide non-required columns/rows
  uxContactPhoneNumbersGrd.RowHeadersVisible = false;
  string[] columnNamesToHide = { "ErrMsg", "ContactsFk", "PhoneNumbersPk", "PhoneTypesFk" };
  SAPSCommon.Instance.HideGridColumns(ref uxContactPhoneNumbersGrd, columnNamesToHide);
  </code></pre>
  
  <p>When I do this, I get 2 columns for the <code>PhoneType</code>, one is the text cell created when populating the DGV, the other is the combobox column I added at design time (even though it has the same DataPropertyName as suggested).</p>
  
  <p>How do I get only 1 column for <code>PhoneType</code> and how do I bind it to the <code>PhoneTypes</code> Table so that the data from the <code>PhoneNumbers</code> Objects sets the correct PhoneType for the respective <code>PhoneNumber</code>?
  (Do I need to bind the <code>PhoneType</code> combobox column 1st before populating the grid with the <code>PhoneNumbers</code> Objects?)</p>