Hi All,
I'm getting the error below when trying to loop through a listbox and then remove the item.
"List that this enumerator is bound to has been modified. An enumerator can only be used if the list does not change."
foreach (string s in listBox1.Items)
{
MessageBox.Show(s);
//do stuff with (s);
listBox1.Items.Remove(s);
}
How can I remove the item and still loop through the contents?
Thanks