ActiveReports 9 > ActiveReports User Guide > Samples and Walkthroughs > Samples > Page Reports And RDL Reports > API > DataSet DataSource |
The DataSetDataSource sample demonstrates how to use the API to load the report and to set the report's dataset at runtime.
Sample Location
Visual Basic.NET
<User Folder>\GrapeCity Samples\ActiveReports 9\Page Reports And RDL Reports\API\DataSetDataSource\VB.NET
C#
<User Folder>\GrapeCity Samples\ActiveReports 9\Page Reports And RDL Reports\API\DataSetDataSource\C#
Runtime Features
When you run this sample, the MainForm with the ActiveReports Viewer appears. The Viewer displays the Parameter pane and the DataGrid control containing the report data in the left part of the Viewer. Set the parameters and click the View Report button to display the report.
Also, the Viewer toolbar contains the custom export button that opens the ExportProperties form where you can set up the options for exporting the displayed report to a specified format.
Project Details
Constants
DataLayer
ExportForm
This is the form that appears when you click the custom Export button on the Viewer's toolbar at runtime. In the Export form, you can select from the following export file format options.
This form uses the ComboBox to show the supported export formats, the Button control to browse to the location where you want to save the exported file, the PropertiesGrid to list down the properties of the selected exported format and two other Button controls that allow you to export the report to a file and reset the fields respectively.
Right-click the form and select View Code to see how to export the report document and define the respective function of Browse, Export and Reset buttons in their Click event.
MainForm
The MainForm has the Splitter control with the ActiveReports Viewer control docked to the right and the DataGrid control docked to the left. The Viewer control displays the report at runtime while the DataGrid control lists the report's data.
Right-click the form and select View Code to see how to initialize and return data for the report, show and load the report in the Viewer and add data to the DataGrid control. It also contains code that adds the custom export button to the Viewer's toolbar and defines its function in the exportbutton_Click event.
ReportFromDataSet
This is the main report that the ActiveReports Viewer displays. This report features the TextBox, Table and Subreport controls. The TextBox and Table controls display data from the dataset; the Subreport control links to the SubReportFomDataSet report.
The report has two parameters, StartDate and EndDate. When the report is displayed in the Viewer, you are prompted to select the start date and end date of sales on the Parameters pane of the Viewer sidebar.
SubReportFomDataSet
This report gets displayed by the SubReport control of the ReportFromDataSet report. This report features the Table data region that displays data from the dataset.
The report has two parameters, StartDate and EndDate.