Skip to Content
0
Former Member
May 09, 2008 at 02:48 PM

Suppress parameter prompt WinForms

21 Views

Post Author: linksfield-leon

CA Forum: General

I know this question might get asked a bit - please bear with me.We have a simple report, which just displays Client Name. The report has a parameter, Client ID which can be null (and it will display all Client Names). Using Crystal Reports 2008 (the most recent download). C# v3.5When report loads, it always displays a parameters dialog with CRITERIA_CLIENT (i.e. name of parameter) showingProblem is, I have already programmatically set this parameter (see code below). QUESTION: As soon as I add a report parameter a prompt will appear, is there any way to suppress this? If not, please just say so and I'll stop looking :)foreach ( KeyValuePair<string, object> pair in reportParameters ){ if ( pair.Value != null && report.ParameterFields&#91; pair.Key &#93; != null && report.ParameterFields&#91; pair.Key &#93;.CurrentValues != null && report.ParameterFields&#91; pair.Key &#93;.CurrentValues.Count > 0 ) { // add to report as param ParameterDiscreteValue discreteVal = report.ParameterFields&#91; pair.Key &#93;.CurrentValues&#91; 0 &#93; as ParameterDiscreteValue; if ( discreteVal != null ) { discreteVal.Value = pair.Value.ToString(); } else { // by this stage we know its a range value ParameterRangeValue rangeVal = report.ParameterFields&#91; pair.Key &#93;.CurrentValues&#91; 0 &#93; as ParameterRangeValue; rangeVal.StartValue = pair.Value.ToString(); } }}