Crystal Report with parameters

  1. Create a form with a label, Button and a Textbox for entring user id that you want to print report add a crystal report viewer control to the form to show Report
  2. Now add a CrystalRerpot form by adding New item (Choose Blank report form the wizard)
  3. Attach a table with this report form filed explorer in crystal report by right click on data connections
  4. insert fileds of table on Reprot detail section from the field section
  5. now click the button on form1 that having crystal report viewer control
  6. in button coading paste the following code in button clicking.

  7.         private void button1_Click(object sender, EventArgs e)

            {

                Employee obj = new Employee(); //Object of Crystal Report

                obj.SetParameterValue("p1", int.Parse(textBox1.Text)); //Providing value to crystal report parameter

                crystalReportViewer1.ReportSource = obj; //assigning crystal report object to crystal report viewer

            }
    Note:- zip file enclosed with this post contain a .doc file conatian all procedure in detail.


         Pardeep Malik