[]
To embed a subreport into a parent report, you add two reports (one parent and one child report) to a Visual Studio project, and from the ActiveReports 19 Section Report toolbox, drag the SubReport control onto the parent report. The following steps take you through the process of adding a subreport in a Section Report.
These steps assume that you have already added a Section Report (code-based) template in a Visual Studio project. Also refer this topic on Design Code-based Section Reports in .NET Core.
Double-click the gray area around the parent report to create an event-handling method for the ReportStart event.
Add code like the following to the handler to create a new instance of the child report.
VB Code:
Dim rpt As rptYourChildReportName
rpt = New rptYourChildReportName()
C# Code:
private rptYourChildReportName rpt;
rpt = new rptYourChildReportName();
type=warning
Caution: It is recommended that you do not create a new instance of the subreport in the Format event. Doing so creates a new subreport each time the section Format code is run, using a lot of memory.
Add the SubReport control onto the design surface of the parent report.
Double-click the detail section of the report to create a detail_Format event.
Add code like the following to the handler to display a report in the SubReport control.
Me.SubReport1.Report = rpt
this.subReport1.Report = rpt;