SAP Knowledge Base Article - Public

1493619 - Error: Object reference not set to an instance of an object

Symptom

  • Running a Crystal Report in a Visual Studio Application result in the viewer displaying expected paramater prompts
  • Once the parameter prompts are submitted the error is thrown

Reproducing the Issue

Use the following code:

If Not IsPostBack Then
    Crystalreportviewerew1.Reportsource = rpt
End If

Resolution

Due to the parameter prompt the correct way to code is as follows:

If Not IsPostBacK Then
   dim rpt as New ReportDocument
   rpt.Load("c:\rep\rep01.rpt")
  'Execute logon code. If required by the report.
 
   Session("myRpt")= rpt
End If
 
CrystalreportViewer1.ReportSource = Session("myRpt")

Keywords

KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To

Product

Crystal Reports 2008 V1 ; SAP Crystal Reports XI R2