listview printing in vb 6 sp5 
Author Message
 listview printing in vb 6 sp5

When I set the listview's View property to lvwReport and use PrintForm, none
of the list items will print though all listitems are displayed in the form.
The printed form has a blank listview. The tree view and its item do print
correctly. Can I use printform to print a form that contains a listview?


Sun, 29 Aug 2004 06:54:19 GMT  
 listview printing in vb 6 sp5

Hi Geoffrey,
I haven't even messed around with PrintForm since the first time I tried it in VB2 or something. There may be a good use for it, but I've yet to find it. The Printer Object is really easy to learn and gives you complete control of the output, give it a whirl...

Start a new project and Double-click a ListView onto a form and double-click a Command Button onto it also, (the code will do the rest)
Paste the following code under the form:

--------------------------------------------------------------------------------

Option Explicit

Private Sub Form_Load()
    Dim Ite As Integer
    On Error Resume Next
    BorderStyle = 3
    BackColor = vbButtonFace
    Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2, 4440, 3400
    Caption = "Printer Object ListView Test"
    Command1.Caption = "&Print"
    With ListView1
        .GridLines = True
        .FullRowSelect = True
        .BorderStyle = ccNone
        .HotTracking = True
        .HoverSelection = True
        .Appearance = ccFlat
        .BackColor = vbButtonFace
        .ForeColor = vbButtonText
        .HideSelection = False
        .Move 0, 0, ScaleWidth, ScaleHeight - 500
        .View = lvwReport
        .ColumnHeaders.Add , , "Col1"
        .ColumnHeaders.Add , , "Col2"
        .ColumnHeaders.Add , , "Col3"
        Command1.Move (ScaleWidth - Command1.Width) / 2, .Height, 1000, 400
        For Ite = 1 To 10
            .ListItems.Add , , Ite & "A"
            .ListItems(.ListItems.Count).ListSubItems.Add , , Ite & "B"
            .ListItems(.ListItems.Count).ListSubItems.Add , , Ite & "C"
        Next
    End With
End Sub

Private Sub Command1_Click()
    Dim Ite As Integer
    On Error Resume Next
    With ListView1
        Printer.FontSize = 22
        Printer.FontBold = True
        Printer.Print "                         My Report"
        Printer.FontSize = 12
        Printer.FontBold = False
        Printer.Print
        For Ite = 1 To .ListItems.Count
            Printer.Print .ListItems(Ite)
            Printer.Print .ListItems(Ite).ListSubItems(1)
            Printer.Print .ListItems(Ite).ListSubItems(2)
            Printer.Print
        Next
        'Now the Print Job is Buffered and ready to send to the printer.
        Printer.EndDoc
    End With
End Sub
--------------------------------------------------------------------------------

You can see I have way too much time on my hands today ;o)
hth...
s



Sun, 29 Aug 2004 22:59:01 GMT  
 listview printing in vb 6 sp5
Hi,

To workaround this problem, you can try the following two ways:

1) Use Microsoft Windows Common Controls 5.0 instead of 6.0

2) Do not use the PrintForm method to print the form. Instead use the
Windows API as shown in the following article:
Q161299 HOWTO: Capture and Print the Screen, a Form, or Any Window
http://support.microsoft.com/support/kb/articles/q161/2/99.asp

This posting is provided "AS IS" with no warranties, and confers no rights.
Copy Right, 2001 Microsoft Corporation. All rights reserved.

Regards,

Kally Wang
Microsoft Support Professional

== Original Message ==


Newsgroups: microsoft.public.vb.controls
Subject: listview printing in vb 6 sp5
Date: Tue, 12 Mar 2002 22:54:19 GMT

When I set the listview's View property to lvwReport and use PrintForm, none
of the list items will print though all listitems are displayed in the form.
The printed form has a blank listview. The tree view and its item do print
correctly. Can I use printform to print a form that contains a listview?



Tue, 31 Aug 2004 14:11:10 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. ListView Problem - VB6 Sp5

2. ListView Problem - VB6 Sp5

3. VB6 SP5 Treeview/Listview redraw problem

4. VB6 SP5 not compatible with pre SP5???

5. Printing problem under NT4/SP5 french version

6. Using VB.Net to Print ListView

7. SEEK HELP WITH LISTVIEW PRINTING IN VB

8. Seek help with listview printing in vb

9. Me.Printform prints empty listview in VB 6.0

10. VB.NET Microsoft WinSock Control, version 6.0 (SP5)

11. Wierd combo problem - VB 6 Sp5 Ent

12. VB 6 sp5 problem, Cannot load control mnuTools

 

 
Powered by phpBB® Forum Software