帮看看:
foreach (ListItem aa in ListBox1.Items)
{
if (aa.Selected == true)
{
this.ListBox1.Items.Remove(aa.Text);
}
}
报错 :集合已修改;可能无法执行枚举操作。
------解决方案--------------------------------------------------------
别用foreach ,就用for循环,从后向前删
------解决方案--------------------------------------------------------
因为按顺序删除之后ListBox1.Items中的内容已经变化,只能按索引倒着删。