Ryan
Ryan

Reputation: 672

calculations in a rdlc report

Using VS 2010 win forms project. I have a winform fo a workorder entry screen. At the bottom of the workorder form are a few calculated textboxes that are calculated from functions in a class.

I have created a rdlc report to print the workorder but now I need to use those functions to represent the calculations to total the workorder, taxes, fees etc.

Can I use the functions by passing them as variables? What is the best way to get these function results on to the report?

Ryan

Upvotes: 0

Views: 1339

Answers (1)

Gianni B.
Gianni B.

Reputation: 2731

Why don't you pass only the value calculated by your functions to the RDLC file? You can use Report Parameters to pass the value to the file.

ReportParameter class

And here you can find a little example to use them

Btw the code will look like this:

//Click to generate the report
ReportParameter p1 = new ReportParameter("NameOfFirstParameter", valueReturningFromYourFunction);
ReportParameter p2 = new ReportParameter("NameOfSecondParameter", valueReturningFromYourFunction);
localReport.SetParameters(p1);
localReport.SetParameters(p2);
localReport.Render(...);

Upvotes: 1

Related Questions