Hi,
I have populated a combobox with a dataadapter and set the DisplayMember and ValueMember as required. So, the conents are essentially:
1 Apple
2 Orange
3 Banana
(Obviously, only the fruit names are visible in the combo)
My problem is, that if I want to display a form with the combobox and set the selected index to the item which has fruit if # 2 (Orange). How do I determine which one I want. Do I have to loop over the contents and check the ValueMember value for item
I suppose I could populate the combo without an adapter, but can I add both a valuemember and a displaymember that way
Thanks,
CW

ComboBox - set selected index
Dave Jacobi
Adam Tappis
I have an DictionaryEntry[] arrEntries that holds
key value
0 Mr
1 Mrs
2 Company
I assign
ComboBox cb = new ComboBox ();
cb.DataSource = arrEntries;
cb.DisplayMember = "Value";
cb.ValueMember = "Key";
Now whatever I assign
cb.SelectedValue to, it won't show up the right preselection.
I can read the correct selected value from the control though.
What am I missing
flarebol
Mike Heffernan