Change text on crystal report

Salam

I have a crystal report that have text fields , which I want to change thier text inside the code.

Dim MyReport As New CashierClosedByCashierClosedIDRPT
MyReport.Section2.ReportObjects.Item("ClosedDate").text= SomeThing

but error come up like this
Error      7      'text' is not a member of 'CrystalDecisions.CrystalReports.Engine.ReportObject'.      


Ahmadal_najjar2003Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mlmccCommented:
Is the field a text or  database field?

I think you can just change it


MyReport.Section2.ReportObjects.Item("ClosedDate")= "SomeThing "

What version of Crystal?
mlmcc
0
Ahmadal_najjar2003Author Commented:
FIrst it is a text not a database field

Second I tried your code but give error :

Error      7      Property 'Item' is 'ReadOnly'.      
0
Mohamed AbowardaSoftware EngineerCommented:
Add the function SetCRText(), and then use the following code:

SetCRText("ClosedDate", "Enter your text here", MyReport)
Private Sub SetCRText(ByVal FieldName As String, ByVal Value As String, ByVal Report As CrystalDecisions.CrystalReports.Engine.ReportDocument)
        Dim cReportTextField As CrystalDecisions.CrystalReports.Engine.TextObject = CType(Report.ReportDefinition.ReportObjects.Item(FieldName), CrystalDecisions.CrystalReports.Engine.TextObject)
        cReportTextField.Text = Value
    End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CodeCruiserCommented:
Another option is to pass parameters to the report and use as text.
0
Ahmadal_najjar2003Author Commented:
That's  really bery nice function

Thank you vey much
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.