hi
i am getting a real troule with my code, i would like to pass a parameter to my crystal Repot document from my code(i am programming wi VB.NET VS2005)
my code in the following:
Dim
cryRpt As New ReportDocument
cryRpt.Load(
"D:\imp_bon_reception.rpt", OpenReportMethod.OpenReportByDefault)
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldDefinition As ParameterFieldDefinition
Dim crParameterValues As New ParameterValues
Dim crParameterDiscreteValue As New ParameterDiscreteValue
crParameterDiscreteValue.Value = Convert.ToInt32(bon_reception.TextB_num.Text)
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields
crParameterFieldDefinition = crParameterFieldDefinitions.Item(
"num_br")
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterValues.Clear()
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
CrystalReportViewer1.ReportSource = cryRpt
CrystalReportViewer1.Refresh()
but i got the fellowing error message in the bold line:
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in CrystalDecisions.CrystalReports.Engine.dll
Additional information: Index non valide. (Exception de HRESULT : 0x8002000B (DISP_E_BADINDEX))
can you help me to solve this problem ?