title: How to set Selected item of ComboBox in C# Windows Forms?
body: <p>I am trying to set selected item of <code>comboBox</code> on click event of DataGrid, but I could not. I have googled and tried different ways but without success.</p>
  
  <p>For me <code>SelectedIndex</code> is working, but I could not find the index of items in ComboBox, so I could not select the item.</p>
  
  <p>Not working code:</p>
  
  <pre><code>for (int i = 0; i &lt; cmbVendor.Items.Count; i++)
  
      if (cmbVendor.Items[i].ToString() == Convert.ToString(gridView1.GetFocusedRowCellValue("vVendor")))
      {
          cmbVendor.SelectedIndex = i;
          break;
      }
  </code></pre>