I am trying to remove all listbox items that contain all spaces(11).I am stuck. This code doesnt remove the items
for (int i = 0; i < tree.Items.Count; i++)
{
if (tree.Items[i].ToString().Contains(" "))
{
tree.Items.RemoveAt(i);
}
}