PRB: PrintForm Does Not Print the ListView Content (318722)



The information in this article applies to:

  • Microsoft Visual Basic Enterprise Edition for Windows 6.0
  • Microsoft Visual Basic Learning Edition for Windows 6.0
  • Microsoft Visual Basic Professional Edition for Windows 6.0

This article was previously published under Q318722

SYMPTOMS

When you use Microsoft Windows Common Controls 6.0, the items in the ListView control do not print with the PrintForm method of the form. Only the first item in the ListView may be visible on the printed document.

RESOLUTION

To resolve this issue, use either of the following methods:
  • Instead of using Windows Common Controls 6.0, use Windows Common Controls 5.0. -or-

  • Instead of using the PrintForm method to print the form, use the Windows API (as shown in the following Microsoft Knowledge Base article), and set the Visible property of the PictureBox object to False.

    161299 HOWTO: Capture and Print the Screen, a Form, or Any Window

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Start a new project.

    By default, Form1 is created.
  2. On the Project menu, click Components, and then click Windows Common Controls 6.0.
  3. Add a ListView and a CommandButton to Form1.
  4. Add the following code to the Code window of Form1:
    Option Explicit
    
    Private Sub Command1_Click()
      Form1.PrintForm
    End Sub
    
    Private Sub Form_Load()
      Dim i As Integer
      For i = 1 To 10
        ListView1.ListItems.Add , , "Item " & i
      Next i
    End Sub
    						
  5. Run the project, and then click the button to print the form.

    You experience the issue described in the "Symptoms" section of this article.

Modification Type:MajorLast Reviewed:6/5/2003
Keywords:kbprb KB318722