troubleshooting Question

C#, Crystal Reports parameter dialog displays randomly

Avatar of DeonM
DeonM asked on
C#Crystal Reports
4 Comments1 Solution419 ViewsLast Modified:

I assign Crystal Reports parameter values and the report displays great with no dialog popups, but sometimes the dialog just appears for no reason and I cannot figure out why.
I run a report and it works great, I keep the same parameter values and sometimes change them, but the dialog still only appears randomly.

Please see my code below. This code is only code that is relevant to handling my parameters. I removed any other unnecessary code.

public partial class frm_ReportViewer : Form
        CrystalDecisions.CrystalReports.Engine.ReportDocument myReport = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

        private const string PARAMETER_REPORT_HEADER = "ReportHeader";

	private void frm_ReportViewer_Load(object sender, EventArgs e)
        	string reportPath = "";
        	ArrayList arrayListreportheader = new ArrayList();
		reportPath = Application.StartupPath + "\\" + "creport.rpt";
                arrayListreportheader.Add("Header text here");

                //SQL query and fill dataset here

		crystalReportViewer1.ReportSource = myReport;
	        ParameterFields parameterFields = myReport.ParameterFields;
       		SetReportHeaderParameterField(parameterFields, arrayListreportheader);

private void SetReportHeaderParameterField(ParameterFields parameterFields, ArrayList arrayList)
            ParameterField parameterField = parameterFields[PARAMETER_REPORT_HEADER];
            ParameterValues currentParameterValues = new ParameterValues();

            foreach (object submittedValue in arrayList)
                ParameterDiscreteValue parameterDiscreteValue = new ParameterDiscreteValue();
                parameterDiscreteValue.Value = submittedValue.ToString();

            parameterField.CurrentValues = currentParameterValues;

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros