If I have a listbox, with the checkbox option, how do I print out all the checked items?
/Nisse
Printable View
If I have a listbox, with the checkbox option, how do I print out all the checked items?
/Nisse
Code:Option Explicit
Private Sub Form_Load()
'load a listbox with a few items and check two items
Dim i As Integer
For i = 0 To 9
List1.AddItem i + 1
If i = 4 Or i = 6 Then
List1.Selected(i) = True
End If
Next i
'find the checked items and print them
For i = 0 To List1.ListCount - 1
List1.ListIndex = i
If List1.Selected(i) = True Then
Printer.Print List1.ListIndex
End If
Next
End Sub
:confused:
Code:Private Sub Command1_Click()
On Error Resume Next
Dim i As Integer
With List1
For i = 0 To .ListCount - 1
If .Selected(i) Then
Printer.Print i
End If
Next
End With
End Sub
..And I see you have this part Wayne, well, it was purdy hard to notice. Just pointing it out... :rolleyes:
[Edited by Matthew Gates on 11-19-2000 at 06:27 PM]
Should it be Printer.Print .List(i) ?