日期:2014-05-19  浏览次数:20949 次

如何将ListBox 里面的列举选项全部清空?
比如:
listBox   里面原来显示有   a,b,c三项。
现在要里面什么都没有,或者只剩下a.该怎么办?

------解决方案--------------------
this.listBox1.Items.Clear();
this.listBox1.Items.RemoveAt(2);//2、3分别代表该项的索引
this.listBox1.Items.RemoveAt(3);
------解决方案--------------------
我收集的一些c#资料http://www.net235.com/web/web/index.htm

------解决方案--------------------
全部清空listBox1.Items.Clear();
删除B,C listBox1.Items.RemoveAt(1);//索引位置 A 0,B 1,C 2
listBox1.Items.RemoveAt(1);//删除B后,C的索引变成1

------解决方案--------------------
支持楼上
------解决方案--------------------
for循环比较灵活。