here code is used like that
private void button1_Click(object sender, EventArgs e){ ReportDocument cryRpt = new ReportDocument();cryRpt.Load("PUT CRYSTAL REPORT PATH HERE\CrystalReport1.rpt");ParameterFieldDefinitions crParameterFieldDefinitions ;ParameterFieldDefinition crParameterFieldDefinition ;ParameterValues crParameterValues = new ParameterValues();ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();crParameterDiscreteValue.Value = textBox1.Text;crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;crParameterFieldDefinition = crParameterFieldDefinitions["Customername"];crParameterValues = crParameterFieldDefinition.CurrentValues;crParameterValues.Clear();crParameterValues.Add(crParameterDiscreteValue);crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);crystalReportViewer1.ReportSource = cryRpt;crystalReportViewer1.Refresh();}
use like that no need to use cryrtp.load method
private void button1_Click(object sender, EventArgs e){ ReportDocument cryRpt = new ReportDocument();ParameterFieldDefinitions crParameterFieldDefinitions ;ParameterFieldDefinition crParameterFieldDefinition ;ParameterValues crParameterValues = new ParameterValues();ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();crParameterDiscreteValue.Value = textBox1.Text;crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;crParameterFieldDefinition = crParameterFieldDefinitions["Customername"];crParameterValues = crParameterFieldDefinition.CurrentValues;crParameterValues.Clear();crParameterValues.Add(crParameterDiscreteValue);crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);crystalReportViewer1.ReportSource = cryRpt;crystalReportViewer1.Refresh();}
No comments:
Post a Comment