title: DataGridViewComboBoxColumn setting selected index
body: <p>I just cant get this to work.
  I have a datagridview in winforms and in this one of my columns is a DataGridViewComboBoxColumn.</p>
  
  <p>In my constructor I set it up like so</p>
  
  <pre><code>DataGridViewComboBoxColumn column = (DataGridViewComboBoxColumn)RectangleGrid.Columns["Material"];
  
          DataTable data = new DataTable();
  
          data.Columns.Add(new DataColumn("Value", typeof(int)));
          data.Columns.Add(new DataColumn("Description", typeof(string)));
  
          foreach (Materials M in DataStructure.Active.Active_Materials)
          {
              data.Rows.Add(M.MaterialNr, (M.MaterialNr + 1).ToString() + " " + M.Material.Name);
          }
  
          column.DataSource = data;
          column.ValueMember = "Value";
          column.DisplayMember = "Description";
  </code></pre>
  
  <p>And it actually works well except that nothing is selected in the drop down box which I want. I have googled this and for instance tried this approach: <a href="http://goo.gl/kBy8W" rel="nofollow">http://goo.gl/kBy8W</a> but with no go because EditingControlShowing only happens when i click the box and not when it first comes up (so I can set selected index once it's clicked but thats no good).
  The CellFormatting version at least changes the value but it just puts a string there rather than my first index from my data source.</p>
  
  <p>I also tried this</p>
  
  <pre><code>column.DefaultCellStyle.NullValue = data.Rows[0]["Description"];
  column.DefaultCellStyle.DataSourceNullValue = data.Rows[0]["Value"];
  </code></pre>
  
  <p>and that seemed to work but then when i selected the first index in the dropdown (so drop the dropdown down and then select the first index and then deselct the cell) I got an error from ParseFormattedValue where it says it cannot convert "value" to system.String.</p>
  
  <p>There was this which seemed to be on the right track but i could not get it to work: <a href="http://goo.gl/VevA3" rel="nofollow">http://goo.gl/VevA3</a></p>