Monday, July 27, 2015

How to use the PrinterSetup Dialog Box From VB6 works with Crystal Reports


Printing the report through the Report Viewer and displaying the 'Print' dialog box====
Dim Report As New CrystalReport1

Private Sub Form_Load()
    'Set the report o the Report Viewer and display the report
    'with a zoom level of 100%

    CRViewer1.ReportSource = Report
    CRViewer1.ViewReport
    CRViewer1.Zoom 100
End Sub

'This event fires when the ''Print'' button in the Report Viewer is clicked
Private Sub CRViewer1_PrintButtonClicked(UseDefault As Boolean)
     'Create an instance of the Printer Setup dialog box
     'Set the handle of the Printer Setup dialog box to the form

     Report.PrinterSetup Form1.hWnd
     'Select Paper Size
     Report.PaperSize = crPaperA5

    'The ''Print'' dialog box will appear by default
    The ''Print'' dialog box needs to be displayed if you want the user
    'to set start page and stop page, the number of copies, and collate

End Sub

No comments:

Post a Comment