How can I remove Items from the list box? It should work like this:
(My list boxes style is checkbox) I select one or more of them and then click the remove button. What code do I need to remove the selected item?
Thank you!
Printable View
How can I remove Items from the list box? It should work like this:
(My list boxes style is checkbox) I select one or more of them and then click the remove button. What code do I need to remove the selected item?
Thank you!
This code should work in removing the checked items:
Code:Dim i As Integer
Dim intMaxItems As Integer
i = 0
intMaxItems = List1.ListCount - 1
Do While i <= intMaxItems
If List1.Selected(i) = True Then
List1.RemoveItem i
intMaxItems = intMaxItems - 1
Else
i = i + 1
End If
Loop
You can do it a little easier by going backward through the list------------------Code:Dim i As Integer
For i = List1.ListCount - 1 To 0 Step -1
If List1.Selected(i) = True Then
List1.RemoveItem i
End If
Next
Marty
HASTE CUISINE
Fast French food.