VB.NET - Wait for form to finish loding before continuing with code.
Posted on 2010-01-11
I have a sub that uses a ping command to determine if specific IPs respond and then sets various attributes accordingly. This process takes 10-15 seconds.
I don't want the user to think the application has hung, so I have a form that displays with a marquee progress bar and a message saying "Please wait...."
I tried calling the sub from the form_load but the form doesn't finish displaying before the sub starts. In fact the please wait screen looks hung until the sub finishes, then displays properly. (I will insert code to close it anyway once I get it working properly.
How can I instruct the code to wait for the form to finish loading before running the sub?
I tried putting the sub call in .gotfocus, but it reacts the same.
Any help is appreciated.