尝试运行此方法时出现错误:
此枚举器绑定(bind)到的列表已被修改。枚举数只能在列表不变的情况下使用。
foreach (var item in lstPhotos.SelectedItems)
{
lstPhotos.Items.Remove(item);
}
如何删除选中的项目?
最佳答案
while(lstPhotos.SelectedItems.Count != 0)
{
lstPhotos.Items.Remove(lstPhotos.SelectedItems[0]);
}
关于c# - 无法从列表框中删除项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3445678/