title: Filter ListBox with TextBox in realtime
body: <p>I am trying to filter an listbox with text from a textbox, realTime. </p>
  
  <p>Here is the code:</p>
  
  <pre><code>private void SrchBox_TextChanged_1(object sender, EventArgs e)
  {
    var registrationsList = registrationListBox.Items.Cast&lt;String&gt;().ToList();
    registrationListBox.BeginUpdate();
    registrationListBox.Items.Clear();
    foreach (string str in registrationsList)
    {
      if (str.Contains(SrchBox.Text))
      {
        registrationListBox.Items.Add(str);
      }
    }
    registrationListBox.EndUpdate();
  }
  </code></pre>
  
  <p>Here are the issues:</p>
  
  <ol>
  <li><p>When I run the program i get this error:  <code>Object reference not set to an instance of an object</code></p></li>
  <li><p>If I hit backspace, my initial list is not shown anymore.  This is because my actual list of items is now reduced, but how can I achieve this?</p></li>
  </ol>
  
  <p>Can you point me in the right direction?</p>