Reporting

  1. Select File | New | Project from the Visual Studio File menu.  Select the Windows Application project, give it a name and location.  Click the OK button to close the dialog.

  2. Right-click the project References and select Add Reference from the context menu. Select the reference for the class library containing your report from the list on the Projects tab. Note: If the class library resides in another solution you will need to use the Browse tab and navigate to the assembly containing the report.

  3. From the ToolBox drag a Telerik ReportViewer control to the Windows form.
  4. Rebuild the Windows Forms project.
  5. In the Properties Window for the report viewer, open the ReportSource dialog, select Instance Report Source and select the report we created in the class library.
    Note

    Once an instance report is selected, notice that a component representing the report appears in the tray below Windows form designer. The component allows you to access the properties of the report in your report viewing application, providing access to report parameters, styles and page settings.

  6. Add a call to the RefreshReport() method of the viewer in the form Load event:
    CopyC#
    private void MainForm_Load(object sender, System.EventArgs e)
    {
        this.reportViewer1.RefreshReport();
    }

     

    CopyVB.NET
    Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
         Me.reportViewer1.RefreshReport()
    End Sub
  7. Copy the connection string which you saved in the application configuration file (app.config) of the report class library, to the configuration file of your windows forms project. By default there is no app.config so you can create a new one from Add -> New Item.
  8. Right-click the Windows report viewing application and select Set as Startup Project from the context menu.
  9. Press F5 to run the report.