Link to home
Start Free TrialLog in
Avatar of AlexPonnath
AlexPonnathFlag for United States of America

asked on

Diplaying a Load message while main form is Loading

My app has a sub, which calls the Login form where my users need to enter Login Info to be able to access the application,
once they pass it opens the Main Window of the App. All that works fine except for the factm that the mainform loads a
large set of data on load which can cause a 10 - 30 sec delay until the form is displayed, depending on serverload and
connection speed.
What i would like to do is open a temp window which will display a message telling the user to
wait while the mainform is beeing loaded, then when the mainform is loaded i want to dispose this form.

i am looking for some samples or help where to hook in the load and dispose of this form or if there are better ways to do this

Avatar of S-Twilley
S-Twilley

I'd say that when your main form is loaded... put the code that loads the dataset into a seperate thread maybe... start that off... then right on the next line, display a modal form saying "Please Wait"... remove the close buttons and such.

Make sure the wait form is declared at class level (I think that's the correct name for it... i.e. outside of a sub/method)  so that when the other thread has completed loading the data, it can close the form.  I'll test this works in a moment... and post up some code to work with
ASKER CERTIFIED SOLUTION
Avatar of S-Twilley
S-Twilley

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Give the other experts a chance to put in their different ideas... they probably have better ones, or may find that mine is not a "good" way of doing things.
you may want to set the borderstyle of the Waiting form to "none" so that the user can't move it around the screen.

Also set the cursor of the Waiting form to the hour glass or pointer/hourglass (app starting)

Obviously, you can customize the waiting for to fit your style... maybe some sort of animation... up to you
Your method looks fine to me s-twilley :-)
Thanks... Im still not 100% confident with doing multi-threaded apps... especially when working other two classes. I've started using delegates and such, but they've all been pretty simple so I've not really come across situations where problems might arise across different threads
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial