Hi, I've borrowed this powershell studio form code from the forum to run a background task then display the result in a textbox,
However the textbox flashes the result, I would like the result to remain until the next updated value is displayed,
Could someone please help?
Windows 10, Powershell studio 2018, v5.5.155
thanks
james
async update GUI text
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.
Re: async update GUI text
Thanks for the reply, but that ends up just adding to the last result, so i end up with "12345...." etc
I want to only see the current text result displayed until it's replaced by the new result, so "1" is displayed until it's replaced by "2" etc.
I want to only see the current text result displayed until it's replaced by the new result, so "1" is displayed until it's replaced by "2" etc.
Re: async update GUI text
If the updates happen too fast then it will always look funny.
What is the purpose of just outputting numbers as fast as you can?
What is the purpose of just outputting numbers as fast as you can?
Code: Select all
Param ($Job)
if($results = Receive-Job -Job $Job | Select-Object -Last 1){
$textbox1.Text = $results
}
Re: async update GUI text
I actually just want to refresh once a minute, but need the last result to display until the next update, which currently isn’t happening, instead it’s flashing for a split second and is then empty u til the next flash update
Re: async update GUI text
thanks, i found my mistake, i removed the if statement surrounding the textbox1.text = $results, which caused empty data to be displayed
thanks
james
thanks
james
Re: async update GUI text
That is not what is happening. The "if statement prevents a null value from being assigned to the text which was the initial issue with your code. Displaying once a second comes when the sleep is set to 60 seconds and not 1000 milliseconds.