简体   繁体   中英

How to pass formula field value in Crystal Report to my Form in C#?

I need to pass formula field Value in Crystal Report to my Form in C#. How can i do it ?

My Code is:

ReportDocument RD = new ReportDocument();
txtNumber.Text=RD.DataDefinition.FormulaFields["Formula Field Name"].Text;

Note: Data type Formula Field is Numeric

This code Get formula field text in Crystal Report to my form in C#.

But, i need formula field value in Crystal Report to my form in C#?

Thank's in advance

I'm posting this answer as nobody has answered a single solution yet. Would ask the community to correct me if I'm wrong, else edit and add more to this for future references.

The code below should fetch the value from the report field

FormulaFieldDefinition value = Report1.DataDefinition.FormulaFields["formulaName"];

But the above mentioned code will not work if the Formula Field Name is a calculated field. Calculated fields have no values until and unless Crystal Report engine has done its rendering .

So what you can do best is to fetch the data you require from the source binding of the report itself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM