I am having a hard time figuring out how to code a series of \"if\" statements that search through different dropdownlists for a specific value entered in a textbox. I was able
If you don't want to use LINQ:
List dropDowns = new List();
dropDowns.Add(comboBox1);
dropDowns.Add(comboBox2);
bool found = false;
ComboBox foundInCombo = null;
int foundIndex = -1;
for (int i = 0; i < dropDowns.Count && found == false; i++)
{
for (int j = 0; j < dropDowns[i].Items.Count && found == false; j++)
{
if (item == textBox1.Text)
{
found = true;
foundInCombo = dropDowns[i];
foundIndex = j;
}
}
}