Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Assuming that I have two separate reports and I want to show it in a crystal report viewer then print it. I use crystal reports 2013 and vb.net

What I have tried:

So far, the print was successful but i only view the first report in the report viewer. Is there a settings that i can view my two reports at the same time? I use the code below.

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class frmStPeter
    Private Sub frmStPeter_Load(sender As Object, e As EventArgs) Handles Me.Load
        Dim c As Integer
        Dim doctoprint As New System.Drawing.Printing.PrintDocument()
        doctoprint.PrinterSettings.PrinterName = "EPSON L120 Series on PC1"

        Dim Report As New ReportDocument
        Dim Report1 As New ReportDocument
        Report.Load("C:\CRep\stPeter.rpt")
        Report1.Load("C:\CRep\stanthony.rpt")

        Dim rawKind As Integer
        For c = 0 To doctoprint.PrinterSettings.PaperSizes.Count - 1
            If doctoprint.PrinterSettings.PaperSizes(c).PaperName = "ClassSchedule" Then
                rawKind = CInt(doctoprint.PrinterSettings.PaperSizes(c).GetType().GetField("kind", Reflection.BindingFlags.Instance Or Reflection.BindingFlags.NonPublic).GetValue(doctoprint.PrinterSettings.PaperSizes(c)))
                Exit For
            End If
        Next
        Report1.PrintOptions.PaperSize = CType(rawKind, CrystalDecisions.Shared.PaperSize)
        Report1.PrintToPrinter(1, False, 1, 1)

        Report.PrintOptions.PaperSize = CType(rawKind, CrystalDecisions.Shared.PaperSize)
        Report.PrintToPrinter(1, False, 1, 1)

        CR1.ReportSource = Report
        CR2.ReportSource = Report1

        CR2.Refresh()
        CR1.Refresh()


    End Sub

End Class
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900