The situation is that I have 2 controls, a text box and a combo box. The user can select something in the combo box, it fills the text box with the value member, if the user types into the text box, I want to check if it exists in the combo box’s values and then select the corresponding display member.
The method I was expecting to be there was something like
if(cmb1.valueMembers.Contains(txt1.Text))
but I can’t find anything like this, I also thought looping through them could find it? so I’ve got
foreach (System.Data.DataRowView row in cmb1.Items)
{}
but can’t find the value member anywhere in the row?
Thanks
Ok, here’s a simple example but I guess that’s the main idea. We have a
MyClasswhich haveIdfor the ValueMember andNamefor the DisplayMember.Feel free to ask if something’s not clear.
PS: In the example I’m assuming that integers will be typed in the textbox