Accessing unbound label field

Posted by: BenAndMarsha on 26 March 2018, 9:55 am EST

    • Post Options:
    • Link

    Posted 26 March 2018, 9:55 am EST

    I’m using Visual Studio 2017, ActiveReports 12, VB.NET

    I have a report called arMenu. This report contains an unbound label field called lblTicketTitle.

    I would like to set the text for this label field when I create the report as follows:

    Dim TheTicket As New arMenu

    TheTicket.lblTicketTitle.text = “This is the report title”

    arMenu.run

    How do I set the text for a control in a report, and then run the report.

    HBH

  • Posted 27 March 2018, 12:50 am EST

    Hello,

    You can use the following line of code to achieve your requirement:

    Dim TheTicket As New arMenu

    CType(arMenu.Sections(“detail”).Controls(“lblTicketTitle”), Grapecity.ActiveReports.SectionReportModel.Label).Text = “This is the report title”

    Also, you can achieve the same thing using the script. Please refer the following link:

    http://help.grapecity.com/activereports/webhelp/AR12/webframe.html#UsingScriptinaSectionReport.html

    Hope it helps.

    Thanks,

    Mohit

  • Posted 29 March 2018, 12:16 pm EST

    When I add that line of code I get the error message shown in the attachment:

    ‘Public Overloads ReadOnly Property Sections as SectionCollection’ has no parameters and its return type cannot be indexed.

  • Posted 2 April 2018, 3:27 am EST

    I have attached a sample application for your reference which uses the code above to change the Label’s text in code and it works without any errors. Please compare your code with the one in the attached application to see the difference.

    AR_Win_GetLabel.zip

  • Posted 5 April 2018, 9:22 am EST

    Thank you.

    My “Programming 101” mistake was that the label “lblTicketTitle” was in the PageHeader section, not the “Detail” section of the report.

    Thus, it couldn’t find the control…

    HBH

  • Posted 9 April 2018, 4:58 am EST

    Glad to know you were able to figure out the mistake. Let us know if you need any other help

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels