How do I find an item by value in an combobox in C#?
You should see a method on the combo box control for FindStringExact(), which will search the displaymember and return the index of that item if found. If not found will return -1.
//to select the item if found:
mycombobox.SelectedIndex = mycombobox.FindStringExact("Combo");
//to test if the item exists:
int i = mycombobox.FindStringExact("Combo");
if(i >= 0)
{
//exists
}
You can find it by using the following code.
int index = comboBox1.Items.IndexOf(a);
To get the item itself, write:
comboBox1.Items[index];