c sharp crystal report

I use crystal report to printout the report from database table directly by using parameter field.
I build a parameter field namely "CurrentCity" with type string and I drag the parameter field to my crystal report form in user form.
And I write the code below to take the value from parameter field to appear in report. The code work well with parameter field...
But I have a problem to close the edit parameter field in which appear all the time with the application appear and force me to input the value.
My application the input is from database directly so I do not want to use the edit parameter field. But the problem is I do not  know the command to inactive the edit parameter field panel. Shall any body help me. I need help.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CrystalDecisions.Shared;
namespace ParameterDiscrete
    public partial class Form1 : Form
        public Form1()
        private void cmdView_Click(object sender, EventArgs e)
            ParameterFields pfs =new ParameterFields();
            ParameterField pf =new ParameterField();
            ParameterDiscreteValue pdv1 = new ParameterDiscreteValue();
            ParameterDiscreteValue pdv2 =new ParameterDiscreteValue();
            if ((txtCity1.Text == "") && (txtCity2.Text == "")) 
7H-@!7- !!!", "%2##'*-", MessageBoxButtons.OK, MessageBoxIcon.Information);
            pf.ParameterFieldName = "CurrentCity";
            pdv1.Value = txtCity1.Text;
            pdv2.Value = txtCity2.Text;
            crvDisplay.ParameterFieldInfo = pfs;
            crvDisplay.ReportSource = new CustomersByCity();

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Richard QuadlingSenior Software DeveloperCommented:
I don't know C#, but in PHP, I use the SetCurrentValue method on the parameter.

I have added the parameter to the report manually, so it is always available.

// Iterate the parameters and set them to the required values shown above.
foreach($o_CrReport->ParameterFields as $i_Parameter => $o_Parameter)
      $o_Parameter->SetCurrentValue($a_ParametersToSupply[$o_Parameter->Name], $o_Parameter->ValueType);

$a_ParametersToSupply[$o_Parameter->Name] is a list of params in a name/value pair.

Adding the param at runtime seems odd. How do you use the param in the report? Just asking for it, doesn't mean it is linked to the select expert or anything.

Don't refresh the report at the end.
That clears all parameter values.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.