Seek help creating CountDown timer for GUI

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 11 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
gvonpickartz
Posts: 26
Last visit: Fri Apr 12, 2024 5:27 am

Seek help creating CountDown timer for GUI

Post by gvonpickartz »

I am looking for a way to display a simple hh:mm:ss count down clock while the gui is active. I can achieve this in the console. GUI however waits for the count down event to complete before showing itself. Example code welcome.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Seek help creating CountDown timer for GUI

Post by jvierra »

Hi - What is a countdown timer? What is being counted down? How do you know how long something is going to take or are you just interested in sitting in a loop waiting for a timeout. In this case it would be a timeout timer.

There is a count-down counter. and time elapsed timer and a timeout timer.

What have you tried?

What do yuou mean by GUI. Tis forum topic is about PowerShell Forms and not about PowerShell ISE or PowerGUI.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Seek help creating CountDown timer for GUI

Post by davidc »

Please refer to the Spotlight on the Timer control article:

http://www.sapien.com/blog/2011/08/09/p ... r-control/

It has a sample on how to create a timer.

You can format DateTime objects to strings using the ToString method with following formatting:

http://go.microsoft.com/fwlink/?LinkId=143638

David
David
SAPIEN Technologies, Inc.
This topic is 10 years and 11 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