Hello,
I have two options for my report, sending it to the viewer or sending it directly to the printer. I have managed to get the parameters passed when using the viewer, but it just wont work when going directly to print.
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Private mReport As ReportDocument
mReport = New ReportDocument()
mReport.Load("MYreportName and PathHere.rpt")
dim strDB = "tableNameHere"
dim WONum as string = "123ABC"
If printFlg = "YES" Then 'printFlg set and defined somewhere else
mReport.SetParameterValue("WONum", WONum)
mReport.PrintOptions.PrinterName = "PrinterName"
mReport.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.DefaultPaperSize
mReport.PrintToPrinter(1, False, 0, 0)
Else
'** Parameter Settings ***'
Dim paramFields As New CrystalDecisions.Shared.ParameterFields()
Dim paramField As New CrystalDecisions.Shared.ParameterField()
Dim paramRange As New CrystalDecisions.Shared.ParameterDiscreteValue()
paramField.ParameterFieldName = "WONum" ' Parameter Name In Crystal Report
paramRange.Value = WONum ' value For Parameter Field
paramField.CurrentValues.Add(paramRange)
paramFields.Add(paramField) ' To add parameter in parameterslist
CR1.ParameterFieldInfo = paramFields 'to pass parameter inf.to CRV
'*** Parm Settings End ***'
CR1.ReportSource = mReport
End If
sorry, wasnt sure how to add the code. Anyway, when it goes to directly to printer after I have published the solution, it says missing parameter value, but if I run it on the development computer it works fine. Do I have syntax errors or am I missing a library?
I get the following warnings when I publish but dont know if they are the issue or if I can just ignore them. Any feedback will be just awesome!!
thanks!
>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4935,5): warning MSB3162: The 'SAP Crystal Reports Runtime Engine for .NET Framework' item selected requires 'Microsoft.Net.Framework.2.0'. Select the missing prerequisite in
the Prerequisites Dialog Box or create a bootstrapper package for the missing prerequisite.
2>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4935,5): warning MSB3162: The 'SAP Crystal Reports Runtime Engine for .NET Framework' item selected requires 'Microsoft.Data.Access.Components.2.8'. Select the missing prerequisite
in the Prerequisites Dialog Box or create a bootstrapper package for the missing prerequisite.