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]);
}
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.