I have a crystalreportviewer on my form, I'd like to from a button on the form be able to update my report with a new parameter value once the report is already loaded, is there a way to change the parameter value in realtime through code, such as if I were to press the refresh button?
Dim param1Fileds As New CrystalDecisions.Shared.ParameterFields Dim param1Field As New CrystalDecisions.Shared.ParameterField Dim param1Range As New CrystalDecisions.Shared.ParameterDiscreteValue param1Field.ParameterFieldName = "emp" param1Range.Value = "Phil" ' value For Parameter Field param1Field.CurrentValues.Add(param1Range) param1Fileds.Add(param1Field) CrystalReportViewer1.ParameterFieldInfo = param1Fileds 'to pass parameter inf.to CRV CrystalReportViewer1.Refresh() Dim param1Fileds1 As New CrystalDecisions.Shared.ParameterFields Dim param1Field1 As New CrystalDecisions.Shared.ParameterField Dim param1Range1 As New CrystalDecisions.Shared.ParameterDiscreteValue param1Field1.ParameterFieldName = "emp" param1Range1.Value = "Carl" ' value For Parameter Field param1Field1.CurrentValues.Add(param1Range1) param1Fileds1.Add(param1Field1) CrystalReportViewer1.ParameterFieldInfo = param1Fileds1 'to pass parameter inf.to CRV CrystalReportViewer1.Refresh()
You should be able to do that. The button won't be part of the viewer.
What is wrong with the refresh button.
Your button should just rerun the code that loads the report and prompts for the parameters.
mlmcc
FCapo
ASKER
I'd like to update the parameter : param1Field1.ParameterFieldName = "emp"
to a different employee name by a button on the form, but it stays stuck on the first value i gave it "Phil"
What is wrong with the refresh button.
Your button should just rerun the code that loads the report and prompts for the parameters.
mlmcc