Results 1 to 5 of 5

Thread: [RESOLVED] multiple items in a listbox

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2005
    Posts
    17

    Resolved [RESOLVED] multiple items in a listbox

    I am trying to remove multiple selected items in a listbox, this code isnt working:
    Code:
    private void btnRemove_Click(object sender, System.EventArgs e)
    {
    	for (int x = 0; x < lstFiles.Items.Count; x++)
    	{
    		if (lstFiles.SelectedIndices.Contains(x))
    		{
    			lstFiles.Items.RemoveAt(x);
    		}
    	}
    }
    Not all selected items get removed, but most of them do.
    edit: seems its the first thing selected that doesnt get removed.
    Last edited by Triumph; Nov 6th, 2005 at 11:44 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width