This is exactly what the new Asynch stuff is designed for and makes it lots easier. In C# it's implemented with the Asynch/Await commands. But the version of .Net that supports that is not in production yet.
>It's pretty straightforward.
>(a) Create a BackgroundWorker Instance.
>(b) Wire it up so that when RunWorkerAsync is called it runs whatever code should be executed in the backgound in bgw_DoWork.
>(c) Set the WorkerReportsProgress true
>(d) Wire up the bgw_ProgressChanged method so that it is called when .ReportProgress is raised in the bgw_DoWork.
>(e) Update the progress bar (or do something else) in the bgw_ProgressChanged callback.
>
>If you want to perform some other action when the worker completes then wire up the RunWorkerCompleted event as well.
>
>The example below is self-contained and debugging that with breakpoints should make it easy to understand what's going on.
>(Don't forget there's a pretty good C# => VB.NET converter at
http://www.developerfusion.com/tools/convert/csharp-to-vb/ )
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer