web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Apps
Answered

Update label text

(2) ShareShare
ReportReport
Posted on by

Hello,

 

I would like to know how to fill a label text by pressing a button.

 

Example. User presses button1 and label1 is updated with Text="button clicked"

 

I've tried setting the button onselect to: [code] label1.text="button clicked" [/code] but nothing happened.

 

Any ideas?

 

Thanks 🙂

 

ps. how do you post code in this forum? [code][/code] doesnt seem to work!

Categories:
I have the same question (0)
  • NEPatton Profile Picture
    360 on at

    Have you tried using a variable or context?

     

    So for instance...

     

    Set your Button's OnSelect to:  Set(myVar,"Hey man!")

    Set your Label's Text to: myVar

     

    Now, everytime myVar is updated, the label text will change.

     

    P.S. - to post code, use the button up above! (at least that's how I produced the following):

    Set(myVar,"Hey man!")
  • Community Power Platform Member Profile Picture
    on at

    This was my first thought but i wondered if there was a simpler way to directly update the field?

     

    Not sure how i 

     

    missed

    that!

  • Verified answer
    NEPatton Profile Picture
    360 on at

    I'm afraid not -- you can't set the text property of a label as part of an action.

     

    If you stick with a decent naming convention, this isn't really all that hard to keep up with.

     

    E.g. For all labels, set .text property = <label_name>_text

     

    EDIT:  pulling information from other posts to make the solution more relevant:  buttons or other controls that change the label text would then need to call a function like:  Set(<label_name>_text,"my new label text")

  • SourabhpowerCSR Profile Picture
    5 on at

    Set(<label_name>_text,"my new label text") is not working. Any feedback. Please help

  • SLPS Profile Picture
    48 on at

    This solution does not work with Custom List Forms, is there a modification that is needed to get it to work?

    Thanks!

  • mshTom Profile Picture
    11 on at

    Dynamically assigning the Text property of a label doesn't work.

    Instead, add a TextInput to a screen and set its DisplayMode to View.

    The TextInput now looks like a label.

    Using the Set() function, create a variable in App.OnStart (you may need to enable this feature in Settings).

    Assign the variable to the Default property of the TextInput.

    In your app, when you reassign the value of the variable, your new "label" will automatically refresh.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard