Click here to Skip to main content
15,170,331 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Updated 14-Sep-21 16:47pm

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();

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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900