How can i unplug selected item in Listbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello everybody...

How can i unplug selected item in Listbox.

Thanks in advance.
Paulo
 
You mean remove the selected item(s)? The code below will remove all the
selected items in the ListBox. If the SelectionMode property of the ListBox
is set to allow selecting multiple items then this code will handle removing
all the selected items.

while (this.listBox1.SelectedIndices.Count > 0)
{
this.listBox1.Items.RemoveAt(this.listBox1.SelectedIndices[0]);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top