Input string variable to textbox/label/?

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 10 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
R1Johnny
Posts: 37
Last visit: Mon Dec 12, 2022 7:15 am

Input string variable to textbox/label/?

Post by R1Johnny »

Good afternoon,
I'm writing a script which informs a user of the number of days until their password expires.
Naturally, this info will be different for each user.
I'd like to send a string variable to some sort of textbox, label, or whatever box-type you recommend to display this string.

There will only be a couple of buttons as input from the user to determine if they want to change their password right then or not.

The GUI portion of this script will be called after the password expiration date has been computed.

I'm currently using a Textbox but the info isn't displayed unless the textbox is the focus and the user presses any key. I'd like the info to be displayed automatically.

Can you please advise what box-object type I should use and perhaps give a hint on the syntax to update the value of the text?

Thanks very much.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Input string variable to textbox/label/?

Post by jvierra »

Sounds like a good us for a timer. Set the time to tick every minute.
User avatar
R1Johnny
Posts: 37
Last visit: Mon Dec 12, 2022 7:15 am

Re: Input string variable to textbox/label/?

Post by R1Johnny »

Thanks very much. (Is the J for John in jvierra?)
Do you have any links that may explain the usage of the timer?
In the meantime I'll check the PowerShell Studio native tools to see if I can figure it out.

thanks again.
regards,
John
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Input string variable to textbox/label/?

Post by jvierra »

The timer is a forms control. It I in the toolbox.
http://www.sapien.com/blog/2011/08/09/p ... r-control/
User avatar
R1Johnny
Posts: 37
Last visit: Mon Dec 12, 2022 7:15 am

Re: Input string variable to textbox/label/?

Post by R1Johnny »

Thanks again for the reply.
In the sample timer script, the Form title (text) changes along with the timing display in the main label window.
Is there a way to get the label window to be updated without updating the Form text?

Thanks again.
regards,
John
User avatar
R1Johnny
Posts: 37
Last visit: Mon Dec 12, 2022 7:15 am

Re: Input string variable to textbox/label/?

Post by R1Johnny »

Thanks again for the reply.
In the sample timer script, the Form title (text) changes along with the timing display in the main label window.
Is there a way to get the label window to be updated without updating the Form text?

Thanks again.
regards,
John
User avatar
R1Johnny
Posts: 37
Last visit: Mon Dec 12, 2022 7:15 am

Re: Input string variable to textbox/label/?

Post by R1Johnny »

I figured it out.
thank you.
This topic is 10 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked