New to Telerik Reporting? Download free 30-day trial

Adding reports to a ReportBook displays a warning in Visual Studio

Environment

Product Progress® Telerik® Reporting
Versions R1 2017 and later
Report Item Report Book

Description

As of the R1 2017 release, adding reports to the ReportBook.Reports collection is obsoleteAPI Breaking Changes.

To allow integration with Standalone Designer, ReportBook was updated to use ReportSource objects for adding the reports.

An updated approach includes adding the necessary ReportSources to the ReportBook.ReportSources collection.

Solution

Solution for adding reports to a ReportBook before the R1 2017 release.

 Telerik.Reporting.ReportBook reportBook = new ReportBook();
 Telerik.Reporting.Report report = new Report1();
 reportBook.Reports.Add(report);
 Dim reportBook As Telerik.Reporting.ReportBook = New ReportBook()
 Dim report As Telerik.Reporting.Report = New Report1()
 reportBook.Reports.Add(report)

Solution for adding reports to a ReportBook after the R1 2017 release.

Telerik.Reporting.ReportBook reportBook = new ReportBook();
Telerik.Reporting.TypeReportSource typeReportSource = new TypeReportSource();
typeReportSource.TypeName = typeof(Report1).AssemblyQualifiedName;
reportBook.ReportSources.Add(typeReportSource);
Dim reportBook As Telerik.Reporting.ReportBook = New ReportBook()
Dim typeReportSource As Telerik.Reporting.TypeReportSource = New TypeReportSource()
typeReportSource.TypeName = GetType(Report1).AssemblyQualifiedName
reportBook.ReportSources.Add(typeReportSource)

See Also

How to migrate your project to utilize the new ReportSource objects

Report Sources

In this article