zl程序教程

您现在的位置是:首页 >  其他

当前栏目

关于ListBox一次性删除多个选项

2023-03-14 10:22:20 时间

倒着删,不会出错

for (int i = this.listBox1.SelectedIndices.Count - 1; i >= 0; i--)
            {
                int currentIndex = this.listBox1.SelectedIndices[i];
                listBox1.Items.RemoveAt(currentIndex);
            }