Passing Paramaters with VB to Crystal Reports
Hi Guys,
Im new to this forum, and I hope some one can help me.
I have a situation where I need to programatically pass paramaters using VB through to my crystal report. I am using Visual Studio 2008 for my development.
Everything is working fine, but when I run the report I get a "Value cannot be Null" error. this is in the Crystal Reports Rorm Viewer.
My complete code is below.
=========================
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports System.Data.OleDb
Public Class Form1
Private Sub CrystalReport11_InitReport(ByVal sender As Object, ByVal e As System.EventArgs) Handles CrystalReport11.InitReport
Dim CR As New ReportDocument
CR.Load("C:\VBScript\WindowsApplication1\CrystalReport1.rpt")
Dim crParameterDiscreteValue As ParameterDiscreteValue
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldLocation As ParameterFieldDefinition
Dim crParameterValues As ParameterValues
crParameterFieldDefinitions = CR.DataDefinition.ParameterFields
crParameterFieldLocation = crParameterFieldDefinitions.Item("@ParameterName1")
crParameterValues = crParameterFieldLocation.CurrentValues
crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
crParameterDiscreteValue.Value = "test"
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldLocation.ApplyCurrentValues(crParameterValues)
CrystalReportViewer1.ReportSource = CR
End Sub
End Class
=========================
As I said my paramater is passed and displayed on the report, but I keep getting this error...
can anyone help.
Re: Passing Paramaters with VB to Crystal Reports
Fix your code. Add [] [/] with Code before the ]
Re: Passing Paramaters with VB to Crystal Reports
I dont understand fix your code?
is it not readable?
Re: Passing Paramaters with VB to Crystal Reports