I am trying to pass a parameter value in from a textbox - right now am tryign to settle for hardcoding the param value and getting the report tp pick it up - here is the code that I am using now:
--------------------------
----------
------
Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
'Dim crReportDocument As DiscreteParam
Dim crParameterFields As CrystalDecisions.Shared.Pa
rameterFie
lds
Dim crParameterField As CrystalDecisions.Shared.Pa
rameterFie
ld
Dim crParameterValues As CrystalDecisions.Shared.Pa
rameterVal
ues
Dim crParameterDiscreteValue As CrystalDecisions.Shared.Pa
rameterDis
creteValue
''Create an instance of the strongly-typed report object
'crReportDocument = New DiscreteParam()
''The viewer's reportsource must be set to a report before any
''parameter fields can be accessed.
'CrystalReportViewer1.Repo
rtSource = "C:\WebSites\WebSite3\rptE
ffectDateE
xcept.rpt"
''Get the collection of parameters from the report
crParameterFields = CrystalReportViewer1.Param
eterFieldI
nfo
''Access the specified parameter from the collection
crParameterField = crParameterFields.Item("@p
rmMonth")
''Get the current values from the parameter field. At this point
''there are zero values set.
'crParameterValues = crParameterField.CurrentVa
lues
crParameterValues = crParameterField.DefaultVa
lues
''Set the current values for the parameter field
crParameterDiscreteValue = New CrystalDecisions.Shared.Pa
rameterDis
creteValue
()
crParameterDiscreteValue.V
alue = "1.00"
''Add the first current value for the parameter field
crParameterValues.Add(crPa
rameterDis
creteValue
)
''Set the modified parameters collection back to the viewer so that
''the new parameter information can be used for the report.
CrystalReportViewer1.Param
eterFieldI
nfo = crParameterFields
CrystalReportViewer1.Repor
tSource = "C:\WebSites\WebSite3\rptE
ffectDateE
xcept.rpt"
End Sub
Start Free Trial