Powershell Studio simple timer assistance

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 3 years and 9 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
rslaav
Posts: 25
Last visit: Sat Oct 01, 2022 6:11 am
Has voted: 2 times

Powershell Studio simple timer assistance

Post by rslaav »

Product, version and build: Powershell Studio 2020
32 or 64 bit version of product: 64
Operating system: Win 10
32 or 64 bit OS: 64

---

How would I create a timer on my form, such that when I click on the label used to the display it, or a button, it begins counting microseconds.

ex:
  1. $labelTimer_Click = {
  2.     $myTimer.Start()
  3.     while($true) {
  4.         $this.Text = $myTimer. ????
  5.     }
  6. }
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: Powershell Studio simple timer assistance

Post by Alexander Riedel »

[Topic moved by moderator]

https://stackoverflow.com/questions/109 ... apsed-time

A simple Google search of "PowerShell Timer" yields quite a number of results.
Microseconds are not practical because even if you could update the display fast enough, it would just be a blur.
Alexander Riedel
SAPIEN Technologies, Inc.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Powershell Studio simple timer assistance

Post by jvierra »

The Windows Forms Timer control only has 1ms interval resolution. The timer is also unreliable for hi-resolution tasks.

See the following for exact specifications: https://docs.microsoft.com/en-us/dotnet ... l-property
rslaav
Posts: 25
Last visit: Sat Oct 01, 2022 6:11 am
Has voted: 2 times

Re: Powershell Studio simple timer assistance

Post by rslaav »

Thanks numb-nut, good know google now has a website for searching stuff. Glad I paid for tech support, and not premium membership.

@jvierra, thank you for the courtesy of providing the additional insight I required.
This topic is 3 years and 9 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