如何清除列表框中选定的项目。 [英] how to clear listbox selected items .

查看:68
本文介绍了如何清除列表框中选定的项目。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想清除列表框中的选择项目。现在当我选择项目并发送列表框中的项目时不清楚。所以如何删除这些特定项目。请给我一个建议。

谢谢,

MK。

i want to clear select item in listbox. now time when i select item and send then item in listbox not clear .so how to these particular item delete. plz give me suggestion.
thanks,
MK.

推荐答案

试试这样..



Try like this..

protected void BtnRemove_Click(object sender, EventArgs e)
{
    int[] itemsSelected = ListBox1.GetSelectedIndices();
    for (int i = 0; i < itemsSelected.Length; i++)
        ListBox1.Items.RemoveAt(i);

}


这篇关于如何清除列表框中选定的项目。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆