Hi
Your thoughts on [System.Windows.Forms.Application]::DoEvents() and the below article?
https://www.sapien.com/blog/2011/07/15/ ... ive-loops/
It is a very old article and there is a lot of bad press about using [System.Windows.Forms.Application]::DoEvents()
My form and progress bar was not responsive when running a loop with a query of hundreds of machines using a runspacepool to do the leg work.
As soon as I inserted [System.Windows.Forms.Application]::DoEvents() in the loop, happy days, no freezing, progress bar and form are fine, I can even drag the form around the screen.
As long as I am disabling and re-enabling the buttons that trigger the query, is there any other considerations I need to have?
Thanks in advance
[System.Windows.Forms.Application]::DoEvents()
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.
-
- Posts: 55
- Last visit: Thu Jun 24, 2021 3:05 am
Re: [System.Windows.Forms.Application]::DoEvents()
Bad press? I read teh newspapers constantly. Never seen any press, good or bad, mention that.
Perhaps you are thinking about an old controversy from early days of VB where people would place a DoEvents after almost every line of code. You know, the old hack, if one pill is good than a thousand must be better.
Perhaps you are thinking about an old controversy from early days of VB where people would place a DoEvents after almost every line of code. You know, the old hack, if one pill is good than a thousand must be better.
-
- Posts: 55
- Last visit: Thu Jun 24, 2021 3:05 am