Results 1 to 16 of 16

Thread: Print a listbox? [Resolved]

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2002
    Posts
    665

    Question Print a listbox? [Resolved]

    When I try to print out this it dosen't look as straight and nice as it looks in the listbox. Why?
    VB Code:
    1. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    2. Private Const LB_SETTABSTOPS = &H192
    3.  
    4. Private Sub Form_Load()
    5. ReDim TabStop(0 To 2) As Long
    6.  
    7.   'assign some values to the tabs for the second third and fourth
    8.   'column (the first is flush against the listbox edge)
    9.    TabStop(0) = 20
    10.    TabStop(1) = 70
    11.    TabStop(2) = 200
    12.  
    13.    
    14.    List1.Clear
    15.   'clear then set the tabs
    16.  
    17.    Call SendMessage(List1.hwnd, LB_SETTABSTOPS, 0&, ByVal 0&)
    18.    Call SendMessage(List1.hwnd, LB_SETTABSTOPS, 3, TabStop(0))
    19.    
    20.     List1.AddItem "Test text" & Chr(9) & "Test Date 0301" & Chr(9) & "MaterialNumber"
    21.     List1.AddItem "Test text 2" & Chr(9) & "Test Date 030104" & Chr(9) & "MaterialNumber"
    22.     List1.AddItem "Test text 3" & Chr(9) & "Test Date 20030301" & Chr(9) & "MaterialNumber"
    23.     List1.AddItem "Test text 4" & Chr(9) & "Test Date Wednesday 04:00 Pm" & Chr(9) & "MaterialNumber"
    24. End Sub
    25.  
    26. Private Sub Command1_Click()
    27.     Dim x As Integer
    28.    
    29.     For x = 0 To List1.ListCount - 1
    30.     Printer.Print List1.List(x)
    31.     Next x
    32. Printer.EndDoc
    33. End Sub
    Last edited by Pirre001; Mar 3rd, 2004 at 02:06 PM.

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