how to remove selected items (multiselect) in listbox 
Author Message
 how to remove selected items (multiselect) in listbox

suppose I have used additem method to add 20 items to a listbox and marked 5
of 20 items in a listbox using shift or control-key (multiselect). How do I
remove them ?

This doesn't work coz the listcount decreases when removing:

For I = 0 To List1.ListCount - 1
        If List1.Selected(I) = True Then list1.RemoveItem(I)
next I

what does work.


Thanks !



Sat, 30 Jun 2001 03:00:00 GMT  
 how to remove selected items (multiselect) in listbox
A simple method would be to loop through the list backwards:

Dim i As Integer
For i = List1.ListCount - 1 To 0 Step -1
        If List1.Selected(i) = True Then List1.RemoveItem (i)
Next i




Tue, 03 Jul 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. how to remove selected items (multiselect) in listbox

2. Newbie q: Remove selected items from multiselect listbox?

3. Selecting All Items In a MultiSelect ListBox

4. Listbox - multiselect : how to get selected items ?

5. ListBox - finding which items are selected with the MultiSelect Property

6. Multiselect listbox: How to SET selected item

7. Remove selected item from listbox

8. Removing the selected item from a listbox

9. how to remove highlight feature at multiselect listbox ??

10. Delete Item in an array which corresponds to Itemsselected in multiselect listbox

11. MultiSelect ListBox Defaults to First Item

12. Capturing item values from multiselect listbox

 

 
Powered by phpBB® Forum Software