If you have installed Visual Studio 2005 or Crystal Reports Developer you have access to the enhanced API that sets the discrete parameters in the Crystal report. The Crystal Reports Developer API helps minimize the amount of code that is needed to set the discrete parameters.
In the previous procedures, you learned to create the SetCurrentValuesForParameterField() helper method.
In this tutorial, you can delete the helper method and instead call the SetParameterValue() method of the ReportDocument class.
The SetParameterValue() method comes in the following overloaded methods:
You can pass in any type of object where the value satisfies the default values for the parameter field. The object can be an Array instance that stores a list of parameter values.
Prerequisites:
However, in Setting Parameters Manually in Code, you only need to create the PARAMETER_FIELD_NAME constant. You do not need to create the SetCurrentValuesForParameterField() help method.
To use the SetParameterValue() method for Discrete Parameters
customersByCityReport.SetParameterValue(PARAMETER_FIELD_NAME, arrayList.ToArray())
customersByCityReport.SetParameterValue(PARAMETER_FIELD_NAME, arrayList.ToArray());
You are now ready to build and run the project, to read and set discrete parameters.
Tutorials: Reading and Setting Parameters with a Subreport | Tutorials: Reading and Setting Discrete Parameters | Tutorials and Sample Code | Tutorials' Sample Code Directory