If I have two elements with the same DisplayMember but with a different ValueMember, and I want to programmatically select one of two elements, how can I do this?
:
123 -> Peter Pan
234 -> John Doe
345 -> Peter Pan
I can’t select the last Peter Pan by doing
Listbox1.FindStringExact("Peter Pan");
because it only returns the first appearance. The following also does not work, since it only sets the selected item but does not display it in the list:
Listbox1.SelectedItem = dataTable.Rows.Find(345);
Who can help me with this?
Update:
Found a bit more information, the list is sorted, so when I update the DataTable (which is used to populate the list), the list is used, and it seems to select the item that was instead of the edited item.
Listbox1.FindStringExact only works if DisplayMember is different