Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

Creating a stringeditcontrol Label by code

Posted on by 434

Hi,

I need to create label for a string edit control in a form. I need code for that . I am new to AX 

Thanks in advance,

Ram

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Creating a stringeditcontrol Label by code

    That's not a business requirement, that's a description of a technical solution that you think would fit the business requirement.

    Could you share the business requirement? What is the process / scenario where you would use this code? I already mentioned in my previous message why it doesn't seem like a good / working idea. Please let us know more so that we can help you as good as possible.

  • Ram Kumar Profile Picture
    Ram Kumar 434 on at
    RE: Creating a stringeditcontrol Label by code

    I need to create a new label by code and i have to set for a stringeditcontrol. or i want to update the existing label with a new label . Is it possible

  • Verified answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Creating a stringeditcontrol Label by code

    Ah, but you asked how to create it in code. What would be the business requirement for that? Could you share it? In general it doesn't seem like a very good idea to me. Usually you have multiple AOS instances in your prod system, and form changes, and new labels are not synced to other AOS instances if you make such changes when the application is running.

    Once we hear your business requirement, we can discuss possible solutions to it.

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Creating a stringeditcontrol Label by code

    Go to the properties of the control. In Label field, type the text that you want to have in the label. Then click the button in the right edge of the property field. Label editor opens, automatically searching if there is already a label that matches your text. If not, you can create a new label. Finally, click "Paste label" to bring this label Id in your stringedit control.

  • Ram Kumar Profile Picture
    Ram Kumar 434 on at
    RE: Creating a stringeditcontrol Label by code

    Hi Nikolaos,

    I want to create new label and to assign the label for the string edit control

  • Ram Kumar Profile Picture
    Ram Kumar 434 on at
    RE: Creating a stringeditcontrol Label by code

    Hi Nikolaos,

    I want to create new label and to assign the label for the string edit control

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Creating a stringeditcontrol Label by code

    Do you mean you want to create a new label? Or assign an existing label?

    For existing label do this:

    1) Set property AutoDeclaration of the control to Yes

    2) In Init method of the form, after super(), add MyControl.label("@MyLabel") (assuming your control is called MyControl and your label id is MyLabel.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans