by Richard Bishop (1 Submission)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 13th May 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Populate and Remove items from a list box.
API Declarations
Set the listbox style property to 1 - Checkbox
Call the first command button cmdFill
Call the second command button cmdRemove
Dim i As Integer
Private Sub cmdFill_Click()
For i = 1 To 20
List1.AddItem i
Next i
End Sub
Private Sub cmdRemove_Click()
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 i
End Sub