如何将 Textbox1 值设置为 Cystal 报告的公式字段 [英] How To Set Textbox1 Value Into Formula Field Of Cystal Reports

查看:16
本文介绍了如何将 Textbox1 值设置为 Cystal 报告的公式字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将 textbox1 的值设置到水晶报表的公式字段中,并在水晶报表中使用相同的值.

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 的顶部.

非常简单,只需创建报告类的实例并在您的 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 + ""; 

首先,您必须在水晶报表中创建公式字段并设置上述代码,然后将公式字段复制到水晶报表中.它将文本框的指定值显示到公式字段中.

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 是 Crystal Report 的 Sections(0) 中文本框的名称

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 值设置为 Cystal 报告的公式字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆