title: C#: If listbox has a certain word delete that item?
body: <p>How to make a for loop that if a listbox has an item that for example has the word <code>"hi"</code> in it it will delete it?</p>
  
  <p>I started working with this but it didnt work:</p>
  
  <pre><code> if (listBox6.Items.ToString() == " ")
   {
       for (int i = 0; i &lt; listBox6.SelectedItems.Count; i++)
       {
            listBox6.Items.Remove(listBox6.SelectedItems[i]);
       }
   }
  </code></pre>