Window with progress bar.

  • Thread starter Thread starter CJM
  • Start date Start date
C

CJM

I have an application that can take several seconds to launch. What I
would like to do, is have a window or something with a progress bar
appear to the user while the app is loading, so that the user knows
something is still happening. Once the app is loaded I would like the
pop up to close.

What I have right now is a new window with a progress bar control on
it. I am calling the window1.Show() in the constructor of the main
form of the app. This seems to work how I would like but the progress
bar control does not load before the app is ready.

Any help on how to fix this or another way would be appreciated.

Thanks.
 
CJM,

What I would do is have two separate forms. You should not be calling
Show on either of them. The first form would be responsible for loading the
application information in another thread, and that thread would make calls
to update the progress bar through calls to the Invoke method. This form
instance would then have it's own message loop, by passing an instance of it
to the static Run method on the Application class. The form would close
itself when the progress bar was full.

Then, you would have another form, and this form would then be
constructed using the results of the initialization during the first form.
You would then create an instance of the second form, and call
Application.Run again with the main form code.

Hope this helps.
 
Back
Top