Pass TextBox value to Crystal Report in C#

This article explains how to pass a TextBox value to Crystal Report Text Object.

Pass TextBox value to Crystal Report in C#

 First, add a TextBox and a Button in the first Windows Form, and in the second add a

CrystalReportViewer and add a Text Object in the Crystal Report. Then in Button click event

add this code:

private void button1_Click(object sender, EventArgs e)
{
    Form2 f2 = new Form2();
    CrystalReport1 cr = new CrystalReport1();
    TextObject text = (TextObject)cr.ReportDefinition.Sections["Section3"].ReportObjects["Text1"];
    text.Text = textBox1.Text;
    f2.crystalReportViewer1.ReportSource = cr;
    f2.Show();
}

For more details watch this video




Pass TextBox value to Crystal Report in C# Pass TextBox value to Crystal Report in C# Reviewed by Bloggeur DZ on 03:48 Rating: 5

7 commentaires:

  1. how about the textboxes and crys. report at same form?

    RépondreSupprimer
  2. I follow what you did on video but still dont put the value to crystal report.no error .but not showing the text

    RépondreSupprimer
  3. f2.crystalReportViewer1.ReportSource = cr; still error this how to fix it

    RépondreSupprimer
  4. use CrystalReporViwer1.ReportSource = name your crystal report ;
    CrystalReportViewr1.Refresh();

    RépondreSupprimer
  5. f2.crystalReportViewer1.ReportSource = cr; still error this how to fix it

    RépondreSupprimer
  6. should make private to public to crystalreportviewer1.....go to property of crystalreportvieweer1 and then click on modifiers to make a public

    RépondreSupprimer

Fourni par Blogger.