Results 1 to 4 of 4

Thread: ***----How to print a data in listbox---***

  1. #1

    Thread Starter
    Lively Member mykg4orce's Avatar
    Join Date
    Oct 2000
    Location
    CANADA
    Posts
    92

    Question

    i need to find out how i can print information from a list box. lets say i have items in a list box as if a receipt, now i need to print the list box so that the printer only prints the list box and no the whole form. Please help!!!!!

  2. #2
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Code:
    Private Sub Command1_Click()
    Dim str As String
    Static x As Integer
    For x = 0 To List1.ListCount
    'put all listitems in a string
        str = str & List1.List(x) & vbCrLf
    Next x
    'Print that string
        Printer.Print str
        Printer.EndDoc
    End Sub
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  3. #3
    Guest
    Why did you declare X as Static?

  4. #4
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Otherwise it won't get updated in a sub right? (or was that for something else


    [Edited by Jop on 10-09-2000 at 03:25 PM]
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

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