Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi,
a bill project, have a form with listbox to fill it with items and every item have a price, button to caluctate the sum, Discount and Total.
then there is a reportview in the same form it filers(i've done it with parametar)
in report design, ive add a page footer, 3 textBox's.
i want to pass the sum, Discount and total value to the textbox's in the report?
any idea!.
C#
www.mediafire.com/view/vth084te37hv7
Posted
Updated 9-Mar-16 22:20pm
v2
Comments
Surendra Adhikari SA 17-Jun-13 6:39am    
show your report load code then we can help
Sunasara Imdadhusen 17-Jun-13 6:57am    
Why you want to pass sum as parameter? you can calculate sum using formula in report and this is correct way..

1 solution

1.At first add 3 parameters on report (go to report >>add parameters give name as 'sum','discount' and 'total'.
2.On report right click on text box and go to expression >> click on parameters (in category)
>> double click on parameters which you want to display in your textbox .
it gives expression as
C#
'=Parameters!sum.Value'

3. apply code below before loading report

C#
ReportParameter[] allPar = new ReportParameter[3]; // create parameters array
ReportParameter parSum = new ReportParameter("sum", "195");
ReportParameter parDiscount = new ReportParameter("discount", "19");
ReportParameter parTotal = new ReportParameter("total", "176");

allPar[0] = parSum; //assign parameters to parameter array
allPar[1] = parDiscount;
allPar[2] = parTotal;

reportViewer1.LocalReport.SetParameters(allPar); // set parameter array
this.reportViewer1.RefreshReport();
 
Share this answer
 
v2
Comments
Maged E William 17-Jun-13 11:56am    
THanQ Sooooo much
Surendra Adhikari SA 17-Jun-13 21:22pm    
... welcome man

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