I'm trying to setup a listbox so that multiple items may be selected and removed at once. The Listbox Multi Select property is currently set to "Extended" and I have the following code on the onclick event of a command button:
I have tested selecting 4 or so records on the list box and then pushing the remove button but it seems that the only record that is removed is the selected record that is furthest down on the listbox. The other selected records become unselected and must be reselected in order to continue removing records. I'm not sure what I'm doing wrong.
Any ideas?
Thanks!
Code:
Private Sub Command12_Click()
Dim i As Integer
For i = List10.ListCount - 1 To 0 Step -1
If List10.Selected(i) Then
List10.RemoveItem i
End If
Next i
End Sub
I have tested selecting 4 or so records on the list box and then pushing the remove button but it seems that the only record that is removed is the selected record that is furthest down on the listbox. The other selected records become unselected and must be reselected in order to continue removing records. I'm not sure what I'm doing wrong.
Any ideas?
Thanks!