Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
2.33/5 (3 votes)
See more:
Hi ,
I am using C# and crystal report , I want to print a table in crystal report and pass variable value from the form , I did it before with SetParameterValue and it worked, but this time I pass the value same way but when the print form open it requires the parameter value again to be entered by user, what is the problem?
Posted
Comments
Maciej Los 22-May-14 12:12pm    
Let me repeat after you: what is the problem?

Refer Below link:


http://www.aspdotnet-suresh.com/2012/01/pass-parameters-to-crystal-reports-in.html
 
Share this answer
 
After I tried all solutions with no results , I found the problem in the print form when it load there is auto added line to refresh the report so all parameter lost values I passed

Thanks
 
Share this answer
 
for example :


C#
CrystalReport1 cr = new CrystalReport3();
cr.DataDefinition.FormulaFields["ID"].Text = "'" + textBox22.Text + "'"; // this is a textbox in form
cr.DataDefinition.FormulaFields["Name"].Text = "'" + textBox21.Text + "'";
cr.DataDefinition.FormulaFields["Surname"].Text = "'" + textBox20.Text + "'";
cr.DataDefinition.FormulaFields["Age"].Text = "'" + textBox24.Text + "'";
cr.DataDefinition.FormulaFields["Location"].Text = "'" + textBox23.Text + "'";
crystalReportViewer3.ReportSource = cr;
cr.PrintToPrinter(1, false, 1, 1);


than add formula into crystalreportviewer....
if u have any troble please ask.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900