
Question: Deleting Multiple Items in ListBox??
Hi everyone,
This is just another "easy" problem that I'm stuck with. Basically, I
have two list box, LEFT & RIGHT.
The one on the left contains several items and I have one command button
to move multiple items that I selected by holding SHIFT or CTRL key
while clicking the left mouse button. The problem is, I also want to
delete all the items that are moved from left to right. As it stands
right now, I'm only copying the selected items on the left to the
right. So my question is how can I delete all the selected items after
I moved them to the right list box?
I have tried to do:
If lstLeft.Selected(I) Then
lstRight.AddItem lstLeft.List(I)
lstLeft.RemoveItem (I)
End If
But it only deleted every other item that I selected before the program
finally crashed. Your help would be greatly appreciated. Thanks in
advance.
Godai
PS: This is the code I have for the command button (below):
--------------------
Private Sub cmdMoveMultiple_Click()
Dim intNumItem, I As Integer
intNumItem = lstLeft.ListCount
For I = 0 To intNumItem - 1
If lstLeft.Selected(I) Then
lstRight.AddItem lstLeft.List(I)
End If
Next I
End Sub