Product: PowerShell Studio 2020 (64 Bit)
Build: v5.7.172
OS: Windows 10 Enterprise (64 Bit)
Build: v10.0.18363.0
PowerShell version(s): 5.1.18362
I keep noticing that the code inside a graphical application is executed before the application window is displayed.
In my particular case I want to display computer information in a new (child) window.
The logic of the background job that gets these information is in the child form.
When I try to open the childform from the mainform, i would expect the childform to open and then
start the job. But the behaviour seems to be different here, the job executes instantly and slows down the opening of
the child form as long as the background job is done.
I probably just lack the programming background here, that's why I'm asking the pros.
Thank you very much for your help.
Please see attached picture.
Load Form before executing code in the script
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
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 LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- GHIsolierung
- Posts: 62
- Last visit: Tue Nov 02, 2021 12:46 am
Re: Load Form before executing code in the script
Without seeing any code, I can only make guesses. If you want code to happen at a specific time, please make sure all code is an an event handler. In your case, starting your job after the form is loaded might be a good idea if its affecting performance. In the childform, try starting the job in the Shown event as this event is only raised the first time a form is displayed.
Brittney
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.