1663340 - Error: The report file name was empty - using ReportDocument1.Load method

SAP Knowledge Base Article - Public

1663340 - Error: The report file name was empty - using ReportDocument1.Load method

Symptom

  • Running an application upgraded from VS 2008 to VS 2010
  • Setting report load method results in the following error:

The report file name was empty

Environment

  • Crystal Reports for Visual Studio 2010
  • VS2010

Reproducing the Issue

  1. Use the code as below on Page Load
Dim reportdocument1 As New CrystalDecisions.CrystalReports.Engine.ReportDocument()
'load the report into the report document component and set the component as the reportsource for the viewer
ReportDocument1.Load("C:\Crystal\crnet\vbnet_win_simplepreviewreport\World Sales Report.rpt")
CrystalReportViewer1.ReportSource = ReportDocument1

2.  Run the application

3. The following InvalidOperationException error will be thrown:

 InvalidOperationException
 The Report Name was empty

Resolution

  • Move the code to:

Public Sub New()
        ' This call is required by the designer.
        InitializeComponent()
        ' Add any initialization after the InitializeComponent() call.
        Dim reportdocument1 As New CrystalDecisions.CrystalReports.Engine.ReportDocument()
        'load the report into the report document component and set the component as the reportsource for the viewer
        ReportDocument1.Load("C:\Crystal\crnet\vbnet_win_simplepreviewreport\World Sales Report.rpt")
        CrystalReportViewer1.ReportSource = reportdocument1
End Sub

 

Keywords

CR2010 2010 CR4VS2010 CR4VS VS2010 NET2010 Crystal Reports for .NET Framework 4.0 crforvs 13 message update , KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , How To

Product

SAP Crystal Reports, developer version for Microsoft Visual Studio