Mega Code Archive

 
Categories / VisualBasic Script / Forms
 

Get all selected items in a list box

Private Sub OKButton_Click()     If ListBox1.ListIndex = -1 Then         msg = "Nothing"     Else         msg = ""         For i = 0 To ListBox1.ListCount - 1             If ListBox1.Selected(i) Then _               msg = msg & ListBox1.List(i) & vbCrLf         Next i     End If     MsgBox "You selected: " & vbCrLf & msg     Unload Me End Sub