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.
Locked
User avatar
R1Johnny
Posts: 37
Joined: Thu Aug 18, 2011 12:22 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: 14480
Joined: Tue May 22, 2007 9:57 am
Contact:

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
Joined: Thu Aug 18, 2011 12:22 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: 14480
Joined: Tue May 22, 2007 9:57 am
Contact:

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
Joined: Thu Aug 18, 2011 12:22 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
Joined: Thu Aug 18, 2011 12:22 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
Joined: Thu Aug 18, 2011 12:22 am

Re: Input string variable to textbox/label/?

Post by R1Johnny »

I figured it out.
thank you.

Locked