Results 1 to 4 of 4

Thread: Listbox

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Posts
    11

    Talking

    If I have a listbox, with the checkbox option, how do I print out all the checked items?

    /Nisse

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    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
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3
    Guest


    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...

    [Edited by Matthew Gates on 11-19-2000 at 06:27 PM]

  4. #4
    Guest
    Should it be Printer.Print .List(i) ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width