title: Basic search in my form, but with a twist
body: <p>I have a groupbox that contains a listbox that displays a bunch of .txt files.
  Also in this groupbox is a textbox that I would like to use to search the list of files. I have added some code to my textbox textchange event, but all it does is clear my listbox, and on backspace the listbox is not repopulating with the .txt files it displays? ant help would be greatly apreciated, thanx</p>
  
  <pre><code>private void custsearchbox_TextChanged(object sender, EventArgs e)
      {
          var itemList = custList.Items.Cast&lt;string&gt;().ToList();
          if (itemList.Count &gt; 0)
          {
              //clear the items from the list
              custList.Items.Clear();
  
              //filter the items and add them to the list
              custList.Items.AddRange(
                  itemList.Where(i =&gt; i.Contains(custsearchbox.Text)).ToArray());
          }
      }
  </code></pre>