Skip to Content
Former Member
Aug 31, 2012 at 02:14 AM

Problem with Crystal Reports for .NET in Windows 7



We were using VB.NET 2010 and CR 11.5 in our current PC and it works fine. We create reports in CR 11.5 and call it in VB.NET 2010. It worked fine so far in our PC and in Users PC.

We were asked to test the application in Windows 7 and the CR failed. I read lot of forums and it said that the following DLL's does not work in Windows 7 with VB.NET 2010.




So we got CR for .NET 2010 and create a small project with just 1 screen that calls the CR that was created in 11.5, but the viewer we used in the project is from the CR for .NET 2010. I included the following reference in the Project

CrystalDecisions.CrystalReports. Engine

CrystalDecisions.CrystalReports. Design




When I created a setup package to install in Windows 7.0, it did not put any Crystal reports DLL in the setup package. After installation, the project did not work and it gave me error. Also the Runtime files for CR for .NET is installed in Windows 7 before the Project was installed.

HEre is the code:

Public Sub OpenCrystalReport(ByRef ReportName As String, ByRef ReportPath As String, ByVal param As String)

Dim objReport As New CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim ConInfo As New CrystalDecisions.Shared.TableLogOnInfo
Dim paraValue As New CrystalDecisions.Shared.ParameterDiscreteValue
Dim currValue As CrystalDecisions.Shared.ParameterValues
Dim mySubReportObject As CrystalDecisions.CrystalReports.Engine.SubreportObject
Dim mySubRepDoc As New CrystalDecisions.CrystalReports.Engine.ReportDocument

Dim intCounter As Integer
Dim index As Integer
Dim strParValPair() As String
Dim strVal() As String

objReport.Load(ReportPath & ReportName)
intCounter = objReport.DataDefinition.ParameterFields.Count

'As parameter fields collection also picks the selection formula which is not the parameter
'so if total parameter count is 1 then we check whether its a parameter or selection formula.
If intCounter = 1 Then
If InStr(objReport.DataDefinition.ParameterFields(0).ParameterFieldName, ".", CompareMethod.Text) > 0 Then
intCounter = 0
End If
End If

'apply parameters to the report
If intCounter > 0 And Trim(param) <> "" Then
strParValPair = param.Split("&")

For index = 0 To UBound(strParValPair)
If InStr(strParValPair(index), "=") > 0 Then
strVal = strParValPair(index).Split("=")
paraValue.Value = strVal(1)
currValue = objReport.DataDefinition.ParameterFields(strVal(0)).CurrentValues
End If
End If

ConInfo.ConnectionInfo.ServerName = "ELTTMSQBES01"
ConInfo.ConnectionInfo.DatabaseName = "absolution_prod"

For intCounter = 0 To objReport.Database.Tables.Count - 1

' Loop through each section on the report then look through each object in the section
' if the object is a subreport, then apply logon info on each table of that sub report
For index = 0 To objReport.ReportDefinition.Sections.Count - 1
For intCounter = 0 To objReport.ReportDefinition.Sections(index).ReportObjects.Count - 1
With objReport.ReportDefinition.Sections(index)
If .ReportObjects(intCounter).Kind = CrystalDecisions.Shared.ReportObjectKind.SubreportObject Then
mySubReportObject = CType(.ReportObjects(intCounter), CrystalDecisions.CrystalReports.Engine.SubreportObject)
mySubRepDoc = mySubReportObject.OpenSubreport(mySubReportObject.SubreportName)
For intCounter1 = 0 To mySubRepDoc.Database.Tables.Count - 1
End If
End With

'Re setting control
CRViewer1.ReportSource = Nothing

'Set the current report object to report.
CRViewer1.ReportSource = objReport

'Show the report
End Sub

The error is

The error is: Could not load file or assembly "CrystalDecisions.Windows.Forms, Version 13.0.2000.0, culture = neutral, PublicKeyToken=692fbea5521e1304" or one of it components. The system cannot find the files specified.

Am I suppossed to include any files in the setup project?? Am I missing something?? Please help. I am unable to proceed in Windows 7 now....