show a form while a background process is running

Capt_Ron

Active member
Joined
Apr 29, 2005
Messages
39
Programming Experience
1-3
Maybe I'm just not understanding but...

What I'm trying to do is show a form while a background process is running. Similar to a progress bar but not a progress bar. We have a form that has an animated gif (customer request) and that's it. no other controls. They want this form to show while the processing in the background is running.

How can I do this? It looks like the BW would work, but i'm not understanding how.
 
Show it before you call RunWorkerAsync, close it when BW says it's finished.
 
Here's my code:
VB.NET:
Private sub MyApplication_Load(ByVal sender as Object, ByVal e as System.EventArgs) Handles Me.Load
      ' This shows the form
      ShowProgressForm()
      BackgroundWorker1.RunWorkerAsync()
      ' This does all the stuff in the background
      StartMyLongCalculation()
End Sub

The form shows up then goes blank when the next process starts.
I can't seem to understand how this process works.

I need for the ShowProgressForm to run then in the background the StartMyLongCalculations process to run. When that is done then I need to to close the form created by ShowProgressForm.

Sorry.
Ron
 
Last edited:
Do you have anything in your BackgroundWorker's DoWork event?

Roughly:

1. Show your ProgressForm
2. Call RunWorkerAsync from your ProgressForm's Load event
3. Call your StartMyLongCalculation() in the BackgroundWorker's DoWork event.
4. Return to your main form in the RunWorkerCompleted event.
 
I feel like an idiot.
Of course I wasn't doing anything in the DoWork method. Why would I? grrrrrr...

Works perfectly now.
Thank you for your patience.

Ron
 
Back
Top