B
Bill Nguyen
Report source is an SQLSERVER 2K store procedure. VB.NET application. Report
created by CR 8.5.
At runtime, I still had to click "CANCEL" to bypass the parameter prompts
before the report display correctly. Also, print option grayed out although
it was available at design time.
Thanks a million!
Bill
---------------
Below is the code:
crRptName = crRptPath & Trim(rptName)
Try
reportDocument1.Load(crRptName)
Dim ParameterFields As CrystalDecisions.Shared.ParameterFields
Dim ParameterField0 As CrystalDecisions.Shared.ParameterField
Dim ParameterField1 As CrystalDecisions.Shared.ParameterField
Dim ParameterDiscreteValue0 As
CrystalDecisions.Shared.ParameterDiscreteValue
Dim ParameterDiscreteValue1 As
CrystalDecisions.Shared.ParameterDiscreteValue
ParameterFields = New CrystalDecisions.Shared.ParameterFields
ParameterField0 = New CrystalDecisions.Shared.ParameterField
ParameterField0.ParameterFieldName = "@salesdate"
ParameterField1 = New CrystalDecisions.Shared.ParameterField
ParameterField1.ParameterFieldName = "@inflag"
ParameterDiscreteValue0 = New CrystalDecisions.Shared.ParameterDiscreteValue
ParameterDiscreteValue0.Value = rptParam0
ParameterDiscreteValue1 = New CrystalDecisions.Shared.ParameterDiscreteValue
ParameterDiscreteValue1.Value = rptParam1
ParameterField0.CurrentValues.Add(ParameterDiscreteValue0)
ParameterField1.CurrentValues.Add(ParameterDiscreteValue1)
ParameterFields.Add(ParameterField0)
ParameterFields.Add(ParameterField1)
lblPrintWait.Text = "Loading report. Please wait..."
lblPrintWait.Visible = True
Me.Cursor = Cursors.WaitCursor
With myCrystal.CrystalReportViewer1
..ReportSource() = reportDocument1
..SelectionFormula = mSelection
If rptParam0 <> "NA" Then
..ParameterFieldInfo = ParameterFields
End If
'.ShowExportButton = True
'.ShowPageNavigateButtons = True
..ShowPrintButton = True
'.PrintReport()
..RefreshReport()
End With
Me.Cursor = Cursors.Default
lblPrintWait.Visible = False
myCrystal.WindowState = FormWindowState.Maximized
myCrystal.ShowDialog()
Catch ex As Exception
MsgBox(ex.Source & ": " & ex.Message)
End Try
created by CR 8.5.
At runtime, I still had to click "CANCEL" to bypass the parameter prompts
before the report display correctly. Also, print option grayed out although
it was available at design time.
Thanks a million!
Bill
---------------
Below is the code:
crRptName = crRptPath & Trim(rptName)
Try
reportDocument1.Load(crRptName)
Dim ParameterFields As CrystalDecisions.Shared.ParameterFields
Dim ParameterField0 As CrystalDecisions.Shared.ParameterField
Dim ParameterField1 As CrystalDecisions.Shared.ParameterField
Dim ParameterDiscreteValue0 As
CrystalDecisions.Shared.ParameterDiscreteValue
Dim ParameterDiscreteValue1 As
CrystalDecisions.Shared.ParameterDiscreteValue
ParameterFields = New CrystalDecisions.Shared.ParameterFields
ParameterField0 = New CrystalDecisions.Shared.ParameterField
ParameterField0.ParameterFieldName = "@salesdate"
ParameterField1 = New CrystalDecisions.Shared.ParameterField
ParameterField1.ParameterFieldName = "@inflag"
ParameterDiscreteValue0 = New CrystalDecisions.Shared.ParameterDiscreteValue
ParameterDiscreteValue0.Value = rptParam0
ParameterDiscreteValue1 = New CrystalDecisions.Shared.ParameterDiscreteValue
ParameterDiscreteValue1.Value = rptParam1
ParameterField0.CurrentValues.Add(ParameterDiscreteValue0)
ParameterField1.CurrentValues.Add(ParameterDiscreteValue1)
ParameterFields.Add(ParameterField0)
ParameterFields.Add(ParameterField1)
lblPrintWait.Text = "Loading report. Please wait..."
lblPrintWait.Visible = True
Me.Cursor = Cursors.WaitCursor
With myCrystal.CrystalReportViewer1
..ReportSource() = reportDocument1
..SelectionFormula = mSelection
If rptParam0 <> "NA" Then
..ParameterFieldInfo = ParameterFields
End If
'.ShowExportButton = True
'.ShowPageNavigateButtons = True
..ShowPrintButton = True
'.PrintReport()
..RefreshReport()
End With
Me.Cursor = Cursors.Default
lblPrintWait.Visible = False
myCrystal.WindowState = FormWindowState.Maximized
myCrystal.ShowDialog()
Catch ex As Exception
MsgBox(ex.Source & ": " & ex.Message)
End Try