I have a report with a simple parameter (string parameter) and I'm setting it with this code:

ParameterFieldDefinition parameter =
_reportDocument.DataDefinition.ParameterFields["Filtro"];
CrystalDecisions.Shared.ParameterValues currentValues = parameter.CurrentValues;
currentValues.Clear();
CrystalDecisions.Shared.ParameterDiscreteValue newValue =
new CrystalDecisions.Shared.ParameterDiscreteValue(); newValue.Value = "Value to Set";
currentValues.Add(newValue);
parameter.ApplyCurrentValues(currentValues);

But when I run the report, the program show an automatic window asking for the value of the parameter. Obviusly, if I set the parameter programatically, I don't need this windows.

Any idea? Something diferente with VS2003?, because the same example in VS2003 works perfect.
Thanks in advance,

I solved the problem. It turns out that in the new version (2005), when you set the datasource it clears all of the current parameters, so you have to set the datasource and logon info before you set the parameter values.

Regards

I have a report with a simple parameter (string parameter) and I'm setting it with this code:

ParameterFieldDefinition parameter =
_reportDocument.DataDefinition.ParameterFields["Filtro"];
CrystalDecisions.Shared.ParameterValues currentValues = parameter.CurrentValues;
currentValues.Clear();
CrystalDecisions.Shared.ParameterDiscreteValue newValue =
new CrystalDecisions.Shared.ParameterDiscreteValue(); newValue.Value = "Value to Set";
currentValues.Add(newValue);
parameter.ApplyCurrentValues(currentValues);

But when I run the report, the program show an automatic window asking for the value of the parameter. Obviusly, if I set the parameter programatically, I don't need this windows.

Any idea? Something diferente with VS2003?, because the same example in VS2003 works perfect.
Thanks in advance,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.