Progress “bar” using threads in vb.net
The
BackgroundWorker
component suits we need (sample code is there in the MSDN link). We handle its DoWork
event and perform the actual query in it. We report the progress by calling itsReportProgress
method. To display the reported progress, we should handle itsProgressChanged
event and update the UI. We start the job by calling the RunWorkerAsync
method of the background worker. Using BackgroundWorker
relieves we from manually starting and stopping threads and communicating with the UI thread to update the progress bar.
No comments:
Post a Comment