Skip to Content

Parameter prompt when exporting and/or Printing a report

Dec 09, 2016 at 05:04 PM


avatar image

With our reports there are usually a set of parameters that the user specifies at runtime and another set of parameters that are set in the background. I need to only prompt for the parameters that have not been set. When previewing the report in crystal reports viewer, it seems to be able to determine what has values and only prompt for the ones that don't. However, this doesn't seem to be the case when I prompt for the parameters when exporting or printing the report straight to the printer. This is what I'm using code-wise:

CrystalReportViewer viewer = new CrystalReportViewer();

viewer.ReportSource = rpt;


I can see using the HasCurrentValue parameter for each of the parameterFields that they do have values set but for some reason they are still shown on the prompt dialog. Is there anyway that I can hide these parameters?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Xin Jiang Dec 16, 2016 at 06:33 AM

Thanks for your reply, but I managed to get it working with setting

crystalReportViewer1:ReuseParameterValuesOnRefresh = true;

Though for some reason, it doesn't work with just that parameter, I needed to load the parameter count first by assigning something like

paramcount = crystalReportViewer1:ParameterFieldInfo:count prior to running viewer.RefreshReport();

Anyway, it's all good now! Thank you!

10 |10000 characters needed characters left characters exceeded
Dell Stinnett-Christy Dec 09, 2016 at 05:26 PM

Unfortunately, there is no API to control the parameters screen when running reports. You would have to create your own parameter screen that would allow the user to specify values for the parameters that are not set in the background and then programmatically set those values on the report prior to viewing or exporting it.


10 |10000 characters needed characters left characters exceeded
Joshua Gordon Feb 24, 2017 at 04:33 PM

I have this same problem. So far I've tried:

Setting CRViewer1.ReuseParameterValuesOnRefresh = True at design time

Setting CRViewer1.ReuseParameterValuesOnRefresh = True at runtime

Calling Dim ParamCount As Integer = CRViewer1.ParameterFieldInfo.Count before calling CRViewer1.RefreshReport()

Everything works fine on certain machines but not others. I can't pinpoint the difference. I've installed SP19 and it hasn't fixed the issue. I have other machines on SP18 that work properly. Does anyone have any other suggestions?

10 |10000 characters needed characters left characters exceeded