1
votes

I've a Crystal Reports report with two parameters. The default prompt of Crystal Reports looks like this:

Crystal Reports Param Prompt

Then the same prompt for the second parameter, etc.

I'd like to know if there's a way to catch the parameter value prompt before it displays, so I can create a modified good looking prompt like this one:

enter image description here

I hope you've understood what I meant.

1

1 Answers

0
votes

The parameter value prompt appears either when you connect the CrystalReportViewer with a report from the "Choose a Crystal Report" dialog and then you run the project or when you manually set the ReportSource property of the CrystalReportViewer inside the code and the execution of the project reaches that point.

So, you can do the following to achieve your goal.

  1. Create a CrystalReportViewer without connecting it from the "Choose a Crystal Report" dialog.
  2. Create a form that will behave as a prompt dialog for the values that you want.
  3. On the main form, create an event which will show the report in the CrystalReportViewer e.g. a Button_Click.
  4. Inside that event, create an instance of the report, show the prompt form that you have created with the ShowDialog method, set the values that you retrieve from the prompt form to the report with the SetParameterValue method and then set the ReportSource property of the CrystalReportViewer to the report.

If you set the values for all your parameters by using the report's SetParameterValue method, the original prompt window will not appear.