Hello,
I have created a form which is using robocopy to copy files.
I have a function which outputs to the progress bar which works fine, however after about 10 seconds into the job and then the form hangs. Although the form is hung the robocopy still carries on working. Once the job has finished the form responds again until around 10 seconds into the next job.
I have added the form refresh ($formname.refresh()) into the while loop whilst the job has a state of running.
TYIA
Problem with form refresh
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: Problem with form refresh
You cannot access a form from a job and you shouldn't try. Doing so can deadlock the form.
You cannot wait on a job in an event as it will freeze the form. Use the JobTracker control and your issues will be gone.
You cannot wait on a job in an event as it will freeze the form. Use the JobTracker control and your issues will be gone.
- TonySpeight
- Posts: 5
- Last visit: Tue Mar 14, 2023 4:57 am
Re: Problem with form refresh
hello jvierra,
Thank you for your reply. I have just found an article explaining the JobTracker. I will give this a go.
Thanks
Tony
Thank you for your reply. I have just found an article explaining the JobTracker. I will give this a go.
Thanks
Tony
- TonySpeight
- Posts: 5
- Last visit: Tue Mar 14, 2023 4:57 am
Re: Problem with form refresh
An update on my issue.
I have added the following line right after my while loop and this has fixed the issue.
[System.Windows.Forms.Application]::DoEvents()
I have added the following line right after my while loop and this has fixed the issue.
[System.Windows.Forms.Application]::DoEvents()