This sample explains the method to inherit a report at run time and design time. The Inheritance sample solution is composed of two classes - the parent class and the child class for both inheritance at run time and design time.
Visual Basic.NET
https://github.com/activereports/Samples18/tree/main/API/Section/Inheritance/VB.NET
C#
https://github.com/activereports/Samples18/tree/main/API/Section/Inheritance/C#
When you run the sample, the report is created and displayed, providing you with the choice of two options - Inheritance Report created at RunTime and Inheritance Report created at Design Time. By clicking a button on the form, you get a report that inherits another class at run time or at design time.
Inheritance Report created at RunTime
The rptInheritBase class is the inheritance class for the generated report when the Inheritance Report created at RunTime button is clicked on the form. The rptInheritBase class inherits the SectionReport class of the GrapeCity.ActiveReports namespace as parent class. It is possible to use DataInitialize event or FetchData event in this class and also possible to load csv file and set values for csv files. It defines the CsvPath property which gets csv file path.
The rptInheritChild class inherits the rptInheritBase class and is a class which only defines the report design. By adding the event handler for inheritance in the constructor and setting for csv file in CsvPath property, it is possible to perform rendering of data executed by event of BaseReport which is the inheritance class.
Inheritance Report created at Design Time
The rptDesignBase class is the inheritance class for the generated report when the Inheritance Report created at Design Time button is clicked on the form. The rptDesignBase class inherits SectionReport class of the GrapeCity.ActiveReports namespace as parent class. Using this class, you can place any control (ReportInfo controls etc. to display report title, page number, page count) you wish to inherit in PageHeader section and PageFooter section. The rptDesignChild class is inherited from rptDesignBase class. It only defines the design of Detail section. PageHeader section and PageFooter section use the design of rptDesignBase class which is an inherited class. DataSource setting can be performed from rptDesignChild class.