In order to display a MindFusion.Reporting report on a form, you need to use an instance of the ReportViewer class. The ReportViewer class is contained in the MindFusion.Reporting.WinForms.dll assembly.
To add an instance of the ReportViewer class to your project, open the Windows form where you want to place the viewer and customize the Visual Studio Toolbox by adding the MindFusion.Reporting.WinForms.dll assembly. Then either drag and drop or double-click on the ReportViewer icon () in the Toolbox. This will create a new instance of the ReportViewer class and place it on the current form.
Note |
---|
You can display the Visual Studio Toolbox through the View -> Toolbox command from the main menu. |
Once the ReportViewer object is created, you can associate it with an existing report through its Report property. You need to ensure that the report is processed by a call to its Run method before the viewer is actually displayed.
The following code illustrates how to create a report and associate it with an existing viewer. The example assumes that reportViewer1 is a variable identifying an existing viewer.
C# Copy Code |
---|
Report report = new Report(); |
Visual Basic Copy Code |
---|
Dim report As New Report() |
The report associated with the viewer in the above example is empty and therefore only a single empty page will be displayed.
For a step-by-step demonstration on how to use the ReportViewer class, refer to Tutorial 1: Getting Started.