This code isn't working. It doesn't raise an exception or even do anything visible.
private void RemoveSelectedFiles()
{
lstPhotos.Items.Remove(lstPhotos.SelectedItems);
}
How can I remove the selected items from a ListBox?
This code isn't working. It doesn't raise an exception or even do anything visible.
private void RemoveSelectedFiles()
{
lstPhotos.Items.Remove(lstPhotos.SelectedItems);
}
How can I remove the selected items from a ListBox?
You have to remove one item at a time.
private void RemoveSelectedFiles()
{
foreach (object item in lstPhotos.SelectedItems)
lstPhotos.Items.Remove(item);
}