title: How to select value on a databound combobox?
body: <p>I have a <code>ComboBox</code> that's been bound to a <code>DataView</code> that's taken a filled <code>DataTable</code>. This <code>DataTable</code> has three columns. Before the <code>DataView</code> is bound to the <code>ComboBox</code> I add another column and set some values. </p>
  
  <pre><code>   Dim table As DataTable = _retrieve.GetAllVersionsTable()
      table.Columns.Add("FirstRow", GetType(Boolean))
  
      Dim row As DataRow = table.NewRow()
      row("ID") = -1
      row("SomeValue") = -1
      row("SomeText") = "N/A"
      row("FirstRow") = True 'Fort sorting...
  
      Dim view As DataView = New DataView(table)
      view.Sort = "FirstRow DESC, SomeText DESC"
  
      table.Rows.InsertAt(row, 0)
  
      comboBox.DataSource = view
      comboBox.ValueMember = "ID"
      comboBox.DisplayMember = "SomeText"
  </code></pre>
  
  <p>Later on, I retrieve the same data and create a new <code>DataTable</code> and bind it to a <code>DataGridView</code> in another form. From this form I set a value for the identity column from selected row in the <code>DataGridView</code>. </p>
  
  <p>When I get back to the first form, with the <code>ComboBox</code>, I wish to select the <code>ComboBox</code> row that has the same value, that I set from the second form, tied to its <code>ValueMember</code> property. I thought that <code>SelectedValue</code> would work for this but it doesn't. What else can I do? </p>
  
  <pre><code>comboBox.SelectedValue = myIdentityValue
  </code></pre>
  
  <p>Since the rows are different I can't use <code>SelectedItem</code> either. Is there a way I can select the appropriate row without having to loop over all existing rows? </p>