Skip to Content
0
Former Member
Feb 16, 2011 at 11:25 PM

How to customise or control the Text Obect Text at Runtime

31 Views

I am not sure if this is the best answer but so far after a lot of searching it is the only method I found to be able to customise a Text Object at runtime - if there is a better method I would appreciate a response

ReportDocument myReport = new ReportDocument();

string reportPath = Server.MapPath("crystalreport1.rpt");

myReport.Load(reportPath);

//set datasource or database logon information

//...

CrystalReportViewer1.ReportSource = myReport;

//control textboxobject

TextObject x;

x = (TextObject)myReport.ReportDefinition.ReportObjects["Text1"];

x.Text = "Customize Text";

or

Dim x As TextObject

x = DirectCast(myReport.ReportDefinition.ReportObjects("Text1"), TextObject)

x.Text = "Customize Text"