cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate IV
Advocate IV

Update label text

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Update label text

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")

View solution in original post

4 REPLIES 4
Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Update label text

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!")
Highlighted
Advocate IV
Advocate IV

Re: Update label text

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!

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Update label text

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")

View solution in original post

Highlighted
New Member

Re: Update label text

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

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,351)