c sharp crystal report

Posted on 2008-11-12
Last Modified: 2012-06-21
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

Question by:teera
    LVL 40

    Assisted Solution

    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.

    LVL 100

    Accepted Solution

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


    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Article by: Najam
    Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
    Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now