Results 1 to 6 of 6
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    283
    Thanks
    0
    Thanked 0 Times in 0 Posts

    remove multiple items from listbox (VB.NEt)

    I would like to know if there is a way to remove multiple (but not all) selected items from a listbox.

    thanks

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: remove multiple items from listbox (VB.NEt)

    Yes, but you will have to explain exactly what you want to do before anyone can make useful suggestions. Computers don't have any concept of "some" of the selected items.
    Charlotte

  3. #3
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    283
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: remove multiple items from listbox (VB.NEt)

    Sorry for not making it clear. Let's say in the listbox I have 5 entries. I have selected/highlighted item 2 and 4. I want to have a command button in VB.NET so that when I click on this button, both the selected entries (ie 2 and 4 in this case) will be deleted immediately.

    thanks

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: remove multiple items from listbox (VB.NEt)

    You just want them removed from the list, nothing else done with them? How are you populating the list in the first place?
    Charlotte

  5. #5
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    283
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: remove multiple items from listbox (VB.NEt)

    I have a textbox where user types in the name to be added (using lstName.Items.Add(txtName.text)) into the listbox via a click on the Add button. I also have a Remove button where I want the user to select multiple names from the list and then click on this button to remove the selected ones all together.

    Thanks

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: remove multiple items from listbox (VB.NEt)

    Then you should be able to loop through the selected items and use the Remove method of the list
    Charlotte

Posting Permissions

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