String doesnot have a definition for ApplycurrentValues
-
i copy this code from an article which is use to take a run time parameters when i run it,it show an error "String doesnot have a definition for ApplycurrentValues" i think i miss a directive for it plz help as i m novice in crystal report reporting. i use only one directive which is
using CrystalDecisions.Shared;
ParameterValues ParamCurrentValues = new ParameterValues();
ParameterRangeValue p\_OrderDate\_Value = new ParameterRangeValue(); p\_OrderDate\_Value.StartValue = this.txtOrderDateFrom.Text; p\_OrderDate\_Value.EndValue = this.txtOrderDateTo.Text; ParamCurrentValues.Add(p\_OrderDate\_Value); rep.DataDefinition.ParameterFields(); ("Date1").**ApplyCurrentValues**(ParamCurrentValues);
-
i copy this code from an article which is use to take a run time parameters when i run it,it show an error "String doesnot have a definition for ApplycurrentValues" i think i miss a directive for it plz help as i m novice in crystal report reporting. i use only one directive which is
using CrystalDecisions.Shared;
ParameterValues ParamCurrentValues = new ParameterValues();
ParameterRangeValue p\_OrderDate\_Value = new ParameterRangeValue(); p\_OrderDate\_Value.StartValue = this.txtOrderDateFrom.Text; p\_OrderDate\_Value.EndValue = this.txtOrderDateTo.Text; ParamCurrentValues.Add(p\_OrderDate\_Value); rep.DataDefinition.ParameterFields(); ("Date1").**ApplyCurrentValues**(ParamCurrentValues);
The code you have copy-and-pasted is almost certainly wrong. I don't know the 1st thing about Crystal Reports (thank higher-being of your choice), but a quick search on the web brought up this (which is similar to your code)
public void SetParameter(string name, object value)
{
//Access the specified parameter from the parameters collection
CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition parameter = _reportDocument.DataDefinition.ParameterFields[name];
// Now get the current value for the parameter and clear them
CrystalDecisions.Shared.ParameterValues currentValues = parameter.CurrentValues; currentValues.Clear();
// Create a value object for Crystal reports and assign the specified value.
CrystalDecisions.Shared.ParameterDiscreteValue newValue = new CrystalDecisions.Shared.ParameterDiscreteValue();
newValue.Value = value;
// Now add the new value to the values collection and apply the
// collection to the report.
currentValues.Add(newValue);
parameter.ApplyCurrentValues(currentValues);
}So it looks like
ApplyCurrentValues
is a method on the parameter.CCC solved so far: 2 (including a Hard One!)