title: Force index selection on combobox when item match C#
body: <p>I have to force my combobox to change the selected index when user enters text and there is an item match. Right now i am getting the item match from my combobox like this:</p>
  
  <pre><code> List&lt;DataRowView&gt; deliveryRoutes = ((ComboBox)sender).Items.Cast&lt;DataRowView&gt;().ToList();
  if (deliveryRoutes.Where(q =&gt; q.Row[0].ToString().ToLower().Equals(((ComboBox)sender).Text.ToLower())).Count() != 0)
  {
  
  }
  </code></pre>
  
  <p>This code checks if the user input is a match with the combobox datasource. in my if statement i want to set the selected index of my combobox to be the matched text. Like so:</p>
  
  <pre><code>DeliveryRouteID.SelectedIndex = matchedTextIndex
  </code></pre>
  
  <p>I have tried getting the index from this without any luck:</p>
  
  <pre><code>deliveryRoutes.Where(q =&gt; q.Row[0].ToString().ToLower().Equals(((ComboBox)sender).Text.ToLower())).FirstOrDefault().Row[0]
  </code></pre>
  
  <p>How would i get the index and set it to be the selected index ?</p>