Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8644

The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception.

$
0
0

I am creating a Visual BASIC .Net windows application in Visual Studio 2013.

 

I have set up a Crystal Report to use the dataset in SAP Crystal Reports 2011.

 

The Visual Basic .Net application is not using the Crystal Report Viewer.  It is using the Report Document class to export the report to a PDF and/or Excel file.  SAP Crystal Reports for Visual Studio has been installed.

 

The error message "The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception." occurs when running the application on a separate Windows 7 system.

 

I used InstallShield Express to create the setup package for the Visual BASIC .Net Windows application.

 

I have ran the setup package on a separate Windows 7 system.

 

The Windows application runs to the point that it shows the window for the application.  As soon as I click on the Run Report button, the error occurs.

 

Here is the code for the button:

 

        strProcedure = "btnRunReport_Click"

        Try

            Dim reportDocument1 As ReportDocument

            reportDocument1 = New ReportDocument()

 

 

            'reportDocument1.FileName = strCurPath + "\PlexACCPriceReport_2.rpt"

 

 

            If IsNothing(reportDocument1) Then

                MsgBox("reportDocument1 is Nothing.")

            End If

 

 

            MsgBox("From Date is " & dtpFromDate.Text & vbCrLf & "To Date is " & dtpToDate.Text)

            'reportDocument1 = Nothing

 

 

        Catch ex As Exception

            strErrorMsg = "Date/Time: " & Format(Now, "MM/dd/yyyy HH:mm:ss") & vbCrLf & _

                        "Procedure: " & strProcedure & vbCrLf & _

                        "Error Message: " & ex.Message & vbCrLf & vbCrLf

            MsgBox(strErrorMsg, MsgBoxStyle.Critical)

        End Try

 

The error occurs on the following line of code:

 

            reportDocument1 = New ReportDocument()

 

What do I need to do to resolve this problem?


Viewing all articles
Browse latest Browse all 8644

Trending Articles