Results 1 to 8 of 8

Thread: URGENT: Print List box content!

  1. #1

    Thread Starter
    Hyperactive Member mastermind94's Avatar
    Join Date
    Jun 2000
    Location
    Montréal, Canada
    Posts
    441

    Post

    I need to print the contain of a list box into 6 colunms.

    EX:


    listbox1.list =
    xxxxxx-xxx
    xxxxxx-xxx
    xxxxxx-xxx
    . . .

    I want that comes out the printer

    xxxxxx-xxx xxxxxx-xxx xxxxx-xxx xxxxxx-xxx xxxxxx-xxx
    xxxxxx-xxx xxxxxx-xxx xxxxx-xxx xxxxxx-xxx xxxxxx-xxx

    Please Help!

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

    <?>

    Have to go to work..just change this to read your
    list

    Option Explicit

    Private Sub Command1_Click()

    Dim i, j, k
    j = 1
    i = "XXXX_ xx"
    For k = 1 To 18
    If j < 6 Then
    Printer.Print i,
    Else
    Printer.Print i:

    If j = 6 Then j = 0
    End If
    j = j + 1
    Next k
    Printer.EndDoc
    End Sub

    'will check at work to see if you need further help
    "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

    Somekind of solution...

    Well, you could print first the listbox contents into a string and print it then.

    Code:
    'just add into any control
    
        Dim A As Integer
        Dim B As Integer
        Dim Text As String
        Text = ""
        Do While A < List1.ListCount 
            B = B + 1
            If B > 6 Then B = 1: Text = Text & vbNewLine
            Text = Text & "  " & List1.List(A)
            A = A + 1
        Loop
        Printer.Print Text
        Printer.EndDoc
    Hope this helps,

    [Edited by MerryVIP on 11-01-2000 at 08:27 AM]

  4. #4
    Hyperactive Member Asaf_99's Avatar
    Join Date
    Jul 2000
    Location
    Israel
    Posts
    335
    Do this:
    Code:
    Private Sub cmdPrint_Click()
    Dim tmp As String
    
    For i = 0 To List1.ListCount - 1
        tmp = tmp & List1.List(i) & vbNewLine
    Next i
        
    Printer.Print tmp
    Printer.EndDoc
    End Sub
    Any help?
    Asaf Sagi

    ICQ: 61917199
    E-Mail: [email protected]

  5. #5
    Hyperactive Member Asaf_99's Avatar
    Join Date
    Jul 2000
    Location
    Israel
    Posts
    335

    Question

    Wait a second...
    Did you want it to come this way:
    xxxxxx-xx
    xxxxxx-xx
    or:
    xxxxxx-xx xxxxx-x

    If you chose the first option see my previous post.
    If you choose the second do this:
    Code:
    Private Sub cmdPrint_Click()
    Dim tmp As String
    
    For i = 0 To List.ListCount - 1
        tmp = tmp & List1.List(i) & "  "
    Next i
        
    Printer.Print tmp
    Printer.EndDoc
    End Sub
    Did this help now?
    Asaf Sagi

    ICQ: 61917199
    E-Mail: [email protected]

  6. #6
    Guest
    He meant, they come six in a line!

    xxxx xxxx xxxx xxxx xxxx xxxx <- End of line 1
    xxxx xxxx xxxx xxxx xxxx xxxx <- End of line 2
    etc.


    My code does this perfectly...So I wonder why you add something that isn't really answer to the question.

    Sorry

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

    <?>

    MerryVip:
    Don't be too harse on other people's answeres; sometimes, they don't quite see it as you or someone else does. Your code is the same as the quick fix I transcribed except that it is expressed by yourself as printing the listbox.

    I was running late for work so I merely expressed it as the formula for doing what was required.



    It doesn't matter what other's post, as long as the questioner can find the answer in the postings, that is all that counts.



    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  8. #8
    Guest
    I know that and that was the "Sorry " for

    But please, people really should read other people posts well before answering...I don't answer when I'm not quite sure what somebody's meaning,I don't know answer or somebody have answered to the question correctly before me.

    Anyway, we should start a new post that blames me if you want to continue


    Though, I've to go now. Online next time tomorrow...

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