如何在crystal报表上显示datepicker值的内容 [英] How to display content of datepicker value on to crystal reports

查看:104
本文介绍了如何在crystal报表上显示datepicker值的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello先生,

带ms访问数据库的C#窗口应用程序。

i有两个日期选择器(选择日期From和date To)我已成功完全过滤和在报告上显示内容详细信息

i希望向用户显示此详细信息,例如: - 从2013年12月2日到2013年3月12日(此日期范围是用户输入)。意思是显示用户在水晶报表标题部分选择的日期选择器输入。



i有水晶报告命名: - Crystalreport1.rpt



我有水晶报告查看器: - crystalreportviwer1



以及上述两个日期选择器旁边的搜索按钮。

解决方案

您好,



很明显,您希望动态更改Crystal报表标头。要这样做,你必须在你的水晶报告中取两个

 TextObject 

。并在加载报告之前将这些日期绑定到相应的TextObjects。



试试这个



 CrystalReport1 sr = new CrystalReport1(); 

TextObject txtheader =(TextObject)sr.ReportDefinition.ReportObjects [txtheaderobject];
//txtheaderobject是Crystal Report Viewer中提到的TextObject。
txtheader.Text =date; //设置标题文本


TextObject txtheader1 =(TextObject)sr.ReportDefinition.ReportObjects [txtheaderobject1];
//txtheaderobject1是另一个TextObject
txtheader1.Text =date1;

//其他编码....

crystalReportViewer1.ReportSource = sr;
crystalReportViewer1.Refresh();





谢谢


查看本教程

C#Crystal Reports - 日期发布日期 [ ^ ]


string dtfrom = dateTimePickerFrom.Value.ToShortDateString();

string dtto = dateTimePickerTo.Value.ToShortDateString();



 rd.SetParameterValue(  FromDate,dtfrom); 
rd.SetParameterValue( ToDate,dtto);


Hello Sir,
C# window application with ms access database.
i have two date picker( to select date From and date To) and i have success fully filter and display the content on the report Detail
i want to show to the user this detail information is for example:- from 2/12/2013 to 3/12/2013 (this date range is users input). meaning display this date picker input that user select on the crystal report header section as a tittle .

i have crystal report named:- Crystalreport1.rpt

and i have crystal report viewer:- crystalreportviwer1

and also search button besides the above two date pickers.

解决方案

Hello ,

It is clear that You want to change the Crystal report header header dynamically . to do so , you have to take two

TextObject

in your crystal report .and bind those dates to the corresponding TextObjects before you load the report.

try this

CrystalReport1 sr = new CrystalReport1();
 
TextObject txtheader = (TextObject)sr.ReportDefinition.ReportObjects["txtheaderobject"];
// "txtheaderobject" is the TextObject  mentioned on Crystal Report Viewer.
 txtheader.Text = "date";//set the header text


TextObject txtheader1 = (TextObject)sr.ReportDefinition.ReportObjects["txtheaderobject1"];
// "txtheaderobject1" is another TextObject
txtheader1.Text = "date1";

//other coding....

crystalReportViewer1.ReportSource = sr;
crystalReportViewer1.Refresh();



thanks


Check this tutorial
C# Crystal Reports - Date to Date[^]


string dtfrom = dateTimePickerFrom.Value.ToShortDateString();
string dtto = dateTimePickerTo.Value.ToShortDateString();

rd.SetParameterValue("FromDate", dtfrom);
         rd.SetParameterValue("ToDate", dtto);


这篇关于如何在crystal报表上显示datepicker值的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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