title: Search anywhere in list, not just the first letter
body: <p>What I want to do, is to search in a ComboBox, for a word, or a part of a word like this:</p>
  
  <p>For example I have these entries in my combobox:</p>
  
  <pre><code>abc
  Abc
  Dabc
  adbdcd
  </code></pre>
  
  <p>And when I search for "<code>abc</code>", it should show me every one in the list, except "</p>
  
  <pre><code>adbdcd"
  </code></pre>
  
  <p>I fill my combobox from a mysql database, so my items are in a "<code>Collection</code>".</p>
  
  <p>I have autocomplete enabled (<em>mode: SuggestAppend, source: ListItems</em>)</p>
  
  <p>This is the code, I am using right now:</p>
  
  <p>private void comboBox1_KeyPress(object sender, KeyPressEventArgs e)
          {
              comboKeyPressed();
          }</p>
  
  <pre><code>    private void comboBox1_TextChanged(object sender, EventArgs e)
      {
          if (comboBox1.Text.Length == 0) comboKeyPressed();
      }
  
      private void comboKeyPressed()
      {
          comboBox1.DroppedDown = true;
  
          object[] originalList = (object[])comboBox1.Tag;
          if (originalList == null)
          {
              // backup original list
              originalList = new object[comboBox1.Items.Count];
              comboBox1.Items.CopyTo(originalList, 0);
              comboBox1.Tag = originalList;
          }
  
          // prepare list of matching items
          string s = comboBox1.Text.ToLower();
          IEnumerable&lt;object&gt; newList = originalList;
          if (s.Length &gt; 0)
          {
              newList = originalList.Where(item =&gt; item.ToString().ToLower().Contains(s));
          }
  
          // clear list (loop through it, otherwise the cursor would move to the beginning of the textbox...)
          while (comboBox1.Items.Count &gt; 0)
          {
              comboBox1.Items.RemoveAt(0);
          }
  
          // re-set list
          comboBox1.Items.AddRange(newList.ToArray());
      }
  </code></pre>
  
  <p>The problem with this code, is if I search for "<code>abc</code>" in my example list, "<code>adbdcd</code>" will show up too. And this code randomly crashes my program when I hit backspace in the combobox.</p>