by www.coderhq.com (5 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Mon 4th March 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Checks which items in a ListBox Control are selected
' Open a new project and add the following
'
' Paste the code in the declarations of your form
'
' Add a ListBox named List1
' Change the Style property of List1 to "1 - Checkbox"
'
' Add a Command button named Command1
'
' Run the project
'
' For more snippets please visit http://www.coderhq.com
Private Sub Command1_Click()
For N = 0 To List1.ListCount - 1
If List1.Selected(N) = True Then
MsgBox List1.List(N) & " is checked"
End If
Next
End Sub
Private Sub Form_Load()
For N = 1 To 10
List1.AddItem "Item Number " & N
Next
End Sub