Hey there, I'm trying to refresh the output to a few textbox's in a form. I'm pulling file count at certain folder locations and this changes constantly. I want to auto 'refresh' the form every 5 minutes or so to get the latest count.
Is this possible to do with a timer? I see the documentation here (https://www.sapien.com/blog/2011/08/09/ ... r-control/) for timer, but nothing to actually refresh data output to a form
Thanks!
Auto refresh a form (textbox output) using timer?
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.
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.
- PS_Studio_User
- Posts: 8
- Last visit: Mon Apr 08, 2019 12:33 pm
- PS_Studio_User
- Posts: 8
- Last visit: Mon Apr 08, 2019 12:33 pm
Re: Auto refresh a form (textbox output) using timer?
Thanks Jvierra, is there an easy way to update the form?
- PS_Studio_User
- Posts: 8
- Last visit: Mon Apr 08, 2019 12:33 pm
Re: Auto refresh a form (textbox output) using timer?
You said I'll need to reacquire the data and update the form, I guess I'm asking if there's a way to automatically do that or does it need to be manual?
- PS_Studio_User
- Posts: 8
- Last visit: Mon Apr 08, 2019 12:33 pm
Re: Auto refresh a form (textbox output) using timer?
Sorry Jvierra, here's an example:
$Total = get count of files at folder location
$TextBox.Text = $Total
Textbox outputs total file count, so say [ 301 ]
However, file count is constantly changing in this folder, maybe its' 241 now, I'd like to somehow have the textbox refresh or update to show the new count maybe every 30 seconds, or 60 seconds - something like that.
Re: Auto refresh a form (textbox output) using timer?
There is no automatic way to do that. You have to redo the query and reassign the value to the textbox.
By the way. This is how to do that.
$TextBox.Text = (Get-ChildItem $folder -FIle).Count
You can stick that in the timer even and set the timer to run as often as you like.
By the way. This is how to do that.
$TextBox.Text = (Get-ChildItem $folder -FIle).Count
You can stick that in the timer even and set the timer to run as often as you like.
- PS_Studio_User
- Posts: 8
- Last visit: Mon Apr 08, 2019 12:33 pm
Re: Auto refresh a form (textbox output) using timer?
Thanks for the update - I've looked at using a timer with this article: https://www.sapien.com/blog/2011/08/09/ ... r-control/
But it only talks about using a timer as just a timer.
Do I just start the timer, run the PS within that, and then stop the timer, then somehow loop it?
But it only talks about using a timer as just a timer.
Do I just start the timer, run the PS within that, and then stop the timer, then somehow loop it?