SilverTab
May 23rd, 2008, 12:23 AM
I have a small window (consisting of just a picturebox and a label saying "Please wait...")...
I want to display the window while my app performs a time consuming operation...(we're talking maybe 3-4 seconds here)...
So i used the following code (not exactly but to give an idea)
formWait myForm = new formWait();
myForm.Show();
callMethodDoingGruntWork();
myForm.Close();
But what happens is that, even though the form is displayed, the controls (the label and picturebox) doesn't show up... then the app locks for 3-4 seconds while the work is being done (fine with me), and the form is closed after....
I tried adding a Thread.Sleep(500) or something like that before calling the time-consuming method but it's not helping...
What can I do so the form actually has time to load before firing my time-consuming method??
(I would prefer not to use a thread since I actually *want* the application to lock while the work is being done)...
Any help would be appreciated!
I want to display the window while my app performs a time consuming operation...(we're talking maybe 3-4 seconds here)...
So i used the following code (not exactly but to give an idea)
formWait myForm = new formWait();
myForm.Show();
callMethodDoingGruntWork();
myForm.Close();
But what happens is that, even though the form is displayed, the controls (the label and picturebox) doesn't show up... then the app locks for 3-4 seconds while the work is being done (fine with me), and the form is closed after....
I tried adding a Thread.Sleep(500) or something like that before calling the time-consuming method but it's not helping...
What can I do so the form actually has time to load before firing my time-consuming method??
(I would prefer not to use a thread since I actually *want* the application to lock while the work is being done)...
Any help would be appreciated!