How to make a for loop that if a listbox has an item that for example has the word "hi" in it it will delete it?
I started working with this but it didnt work:
if (listBox6.Items.ToString() == " ")
{
for (int i = 0; i < listBox6.SelectedItems.Count; i++)
{
listBox6.Items.Remove(listBox6.SelectedItems[i]);
}
}
you can try like this….
Iterate using an index, starting at the last item: