Quote Originally Posted by trevorjeaton View Post
Here's a question to add to this by the way if anyone can contribute - I'm looking to figure out how to deal with a selectedindexchanged event on the child of this binding so i can pull additional values instead of being restricted to the single value member......

in my iteration of this concept, i'd like to be able to process on a valuemember in addition to ID.

normally with a table adapter i would just call the following:

Code:
TableAdapter.GetData.Item(combobox2.SelectedIndex).Field_I_Want_To_Work_With
but in this case its not a tableadapter nor is the selected index of the combobox reflective of the record position as a whole......so it will pull inaccurate data....

any help would be appreciated...
The SelectedItem of the ComboBox is the entire bound item, so you simply cast it as the appropriate type and then get whatever property of column value you want. For instance, if you've bound a DataTable then each item is a DataRowView, therefore the SelectedItem is a DataRowView. As such you can get the SelectedItem, cast it as type DataRowView and then get any field you want, e.g.
vb.net Code:
  1. Dim row As DataRowView = DirectCast(myComboBox.SelectedItem, DataRowView)
  2. Dim firstName As String = CStr(row("FirstName"))
  3. Dim lastName As String = CStr(row("LastName"))