Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have problem with crystal report. This is the scenario.

I want to print to printer from vb.net --> crystal Report --> Printer.

There is one blank field called DOType. When i run the program, i want to print with 1 Original (blank field called DOType was changed into "ORIGINAL") and 2 copies (blank field called DOType was changed into "COPY")

Here is my code :

VB
Dim cryRpt As New ReportDocument
cryRpt.Load("RASManualDeliveryOrder.rpt")
Dim crParameterDiscreteValue As ParameterDiscreteValue
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldDefintion As ParameterFieldDefinition
Dim crParameterValues As ParameterValues

crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields
crParameterFieldDefintion = crParameterFieldDefinitions.Item("@DOType")
crParameterValues = crParameterFieldDefintion.CurrentValues
crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
crParameterDiscreteValue.Value = "ORIGINAL"
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefintion.ApplyCurrentValues(crParameterValues)
Form1.CrystalReportViewer1.ReportSource = cryRpt
Form1.CrystalReportViewer1.Refresh()
Form1.Show()


An error occured while in "crParameterFieldDefintion = crParameterFieldDefinitions.Item("@DOType")"

Any idea ?
Posted
Comments
DamithSL 4-Nov-14 22:43pm    
DOType should be a parameter and try without @ like crParameterFieldDefinitions.Item("DOType")
Member 11207217 4-Nov-14 23:07pm    
i've tried too. But still can't. Even i try to change it into '#' , '%'

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900