New to Telerik Reporting? Download free 30-day trial

Adding Manually the WinForms Report Viewer to a Windows Forms .NET Framework Project

Assign report to the viewer in design time

To use Telerik Reports in Windows Forms application, you need the Windows Forms report viewer:

  1. Drag the ReportViewer control from the Toolbox to the form design surface.

    Image showing how the ReportViewer control can be added to the form through the Visual Studio Toolbox

  2. Add reference to the class library that contains your reports in the windows form application.

  3. Build the application.
  4. Set the ReportSource for the report viewer. For more information, see How to Set ReportSource for Report Viewers.
  5. To run the report in the viewer, call ReportViewer.RefreshReport() from your application code.

Assign report to the viewer programmatically

In the Form_Load event handler you create an instance report source and set its ReportDocument property to a report instance. Next assign the instance report source to the ReportSource property of the viewer. Finally call ReportViewer.RefreshReport().

private void Form1_Load(object sender, EventArgs e)
{
    var typeReportSource = new Telerik.Reporting.TypeReportSource();
    typeReportSource.TypeName = "Telerik.Reporting.Examples.CSharp.ListBoundReport, CSharp.ReportLibrary";
    this.reportViewer1.ReportSource = typeReportSource;
    reportViewer1.RefreshReport();
}
Private Sub Form1_Load(sender As Object, e As EventArgs)
    Dim typeReportSource = New Telerik.Reporting.TypeReportSource()
    typeReportSource.TypeName = "Telerik.Reporting.Examples.CSharp.ListBoundReport, CSharp.ReportLibrary"
    Me.ReportViewer1.ReportSource = typeReportSource
    ReportViewer1.RefreshReport()
End Sub

If the current application has to be declared as DPI-aware, an additional element needs to be added to the application manifest file, as explained in the article Declaring the application as DPI-aware.

See Also

In this article