Add new page in crystal report vb6
A blast from the past!
To add a new page in Crystal Report in VB6, you can follow these steps:
- Open your VB6 project and navigate to the form where you have the Crystal Report control.
- In the Toolbox, find the Crystal Report control and drag-and-drop it onto the form. This will create a new instance of the Crystal Report control.
- In the Properties window, set the
Report
property of the Crystal Report control to the name of the report you want to display. - To add a new page to the report, you need to create a new instance of the
CrystalDecisions.CrystalReports.Engine.ReportDocument
class and set itsReportDefinition
property to the report definition you want to use. - Create a new instance of the
CrystalDecisions.CrystalReports.Engine.Page
class and set itsReportDocument
property to theReportDocument
instance you created in step 4. - Add the new page to the report by calling the
ReportDocument.Pages.Add
method and passing the new page instance as an argument. - Set the
CurrentPage
property of the Crystal Report control to the new page you just added.
Here's some sample code to illustrate these steps:
Dim rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument
rpt.Load "YourReport.rpt"
Dim page As New CrystalDecisions.CrystalReports.Engine.Page
page.ReportDocument = rpt
rpt.Pages.Add page
CrystalReport1.Report = rpt
CrystalReport1.CurrentPage = page
Note that you need to replace "YourReport.rpt" with the actual name of your report file.
Also, make sure that you have the Crystal Reports runtime installed on your system and that you have referenced the Crystal Reports DLLs in your VB6 project.