How to set Selected item of ComboBox in C# Windows Forms?

You can get your item index by the .Items.IndexOf() method. Try this:

comboBox1.SelectedIndex = comboBox1.Items.IndexOf(gridView1.GetFocusedRowCellValue("vVendor"));

You don't need to iterate.

You can find more information in Stack Overflow question How do I set the selected item in a comboBox to match my string using C#?.


The following is working for me perfectly. Pass any value or Text which is available in the combobox.

comboBox1.SelectedIndex = comboBox1.FindString(<combobox value OR Text in string formate>);

You have it in your if:

cmbVendor.SelectedItem = cmbVendor.Items[i];