如何设置Textbox1值到Crystal报表的公式域 [英] How To Set Textbox1 Value Into Formula Field Of Cystal Reports
问题描述
我想将textbox1值设置为Crystal报表的公式字段,并将相同的值用于Crystal报表。
I want to set textbox1 value into formula field of crystal reports and Utilise the same value into crystal reports.
假设我的Textbox1值为12000 ,我想将其设置为公式字段,并将其用于水晶报表。是否可以?。
Suppose my Textbox1 value is "12000" and I want to set it to formula field and utilize the same into crystal reports. Is it possible?. And yes then How?.
注意: textbox1位于CrystalReportviewer1之上。
很简单,只需创建report类的实例,并在crystalreportviewer源文件中设置textBox的值为:
It is very simple just create the instance of the reports class and set the textBox value in your crystalreportviewer source as under:
PLCrystReport plc = new PLCrystReport();
plc.DataDefinition.FormulaFields["ttt"].Text = "" + textBox1.Text + "";
首先,您必须在Crystal报表中创建公式字段,然后设置上述代码将您的公式字段复制到Crystal报表。它会将文本框的指定值显示在公式字段中。
For above first you have to create the formula field in your crystal reports and set the above code then after copy your formula field to your crystal reports. It will shows the specified value of textbox into formula field.
注意[ttt]是公式字段名称。
Note ["ttt"] is the formula field name. which provided into crystal reports.
推荐答案
Dim RptForm As CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim T As CrystalDecisions.CrystalReports.Engine.TextObject
RptForm = New MyCrystalReport()
T = RptForm.ReportDefinition.Sections(0).ReportObjects("TXTCNAME")
T.Text = DTPTDate.Value
这里的TXTCNAME是水晶报表
Here TXTCNAME is the name of textbox present in Sections(0) of Crystal Report
MyCrystalReport是您要使用的水晶报表。
MyCrystalReport is the crystal Report you want to use.
这篇关于如何设置Textbox1值到Crystal报表的公式域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!