Errors in using BackgroundWorker Component in WinForm 2.0 Development
It's much simpler as in WinForm 1.0 dev (no more manual delegation), and this component expose events: DoWork, ProgressChanged and RunWorkerCompleted. What we have to do is to trigger the RunWorkerAsync method, update the ProgressBar control in the ProgressChanged event (most of the cases), and then finish up all works in the RunWorkerCompleted event. Yes, the name of these events explains its usage already, and VS2005 also provides a thread-safe (read more...) dev environment / notification for you throughout the dev process.
However, what I got suck is the WorkerReportsProgress and WorkersSupportCancellation properties... I prepared the module and ready to run, but the result is not what I expect. I tried to debug it and caught this exception:
The WorkerReportsProgress and WorkersSupportCancellation properties need to be config as True if you want to report a progress state or break the asyn call during execution. Well, and the default values are False... :S
Colt Kwong