For simplicity I have 2 classes, one that has the Mainform and the other that handles most of the work for that form. In the main form, I call the a method in my class that does a few things and then kicks off the BGW to pull oracle data.
When the BGW is complete (RunWorkerCompleted), I return the dataset from (e.result) to my main form by raising an event which is caught by code in the main form. Herein lies the issue. When the dataset is returned, I call another routine in a different class and pass the dataset to it for processing.
I am worried that my bgw never fully gets to complete. I believe because of the "RaiseEvent" , it continues running the rest of my code. The only way I see to actually allow it to stop is to get to a point where code execution stops and User input is required. The way I currently have the app designed is that the user makes selections on what they want to see, data is pulled, manipulated and then spit out to a report. At that pooint execution is stopped. Seems like a bad thing to me, but I am a little new at this and maybe there is something I have missed.
Thoughts?
ASKER
If e.cancelled = False then
bgw.dispose
RaiseEvent WorkerComplete
...
So, the workercompleted is hit and the e.cancelled is checked, generally this is false, so it goes and does the dispose and reports to the mainform that the work has completed. Then the code runs in the main form until all application execution stops. Once this happens it will go back to the End if, End sub.
I was just curious if this is a problem. Everything operates as I want and I don't see any issues, but the real RunWorkerCompleted never reaches End Sub until all other execution is finished.