SAP Knowledge Base Article - Preview

2699243 - Can I change the Subreport name and subreport Object name using Crystal reports for Visual Studio .NET SDK

Symptom

We are trying to set the "Object Name" of a subreport using C#. The Name property shows as get; set and accepts the string value we set. But when the report is saved with the C# code and checked in designer, it still shows "Subreport1".

Code Sample below works without any error but when the report is opened using Crystal Reports Designer it shows that the object name is still "Subreport1":

  • CrystalDecisions.CrystalReports.Engine.ReportDocument Mainrd; string RPTPath = @"C:\Main.rpt"; Mainrd.Load(RPTPath);
  • ReportObjectController rptObjCtrl = Mainrd.ReportClientDocument.ReportDefController.ReportObjectController; rptObjCtrl.GetReportObjectsByKind(CrReportObjectKindEnum.crReportObjectKindSubreport)[0].Name = "TestSub";
  • Mainrd.SaveAs(RPTPath);
  • Mainrd.Close();


Read more...

Environment

Crystal Reports, Developer for Visual Studio

Product

SAP Crystal Reports, version for Visual Studio .NET 2005

Keywords

cr for vs, subreport name , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Problem

About this page

This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required).

Search for additional results

Visit SAP Support Portal's SAP Notes and KBA Search.