Article Options
Premium Sponsor
Premium Sponsor

Multithreading The Easy Way: The BackgroundWorker
by Ged Mead | Published  06/01/2008 | Framework 2.0 Framework 3.0 .NET Intermediate Visual Studio 2005 Visual Studio 2008 Visual Basic 2005 Windows Presentation Foundation | Rating:
Ged Mead

Ged Mead (XTab) is a Microsoft Visual Basic MVP who has been working on computer software and design for more than 25 years. His journey has taken him through many different facets of IT. These include training as a Systems Analyst, working in a mainframe software development environment, creating financial management systems and a short time spent on military laptop systems in the days when it took two strong men to carry a 'mobile' system.

Based in an idyllic lochside location in the West of Scotland, he is currently involved in an ever-widening range of VB.NET, WPF and Silverlight development projects. Now working in a consultancy environment, his passion however still remains helping students and professional developers to take advantage of the ever increasing range of sophisticated tools available to them.

Ged is a regular contributor to forums on vbCity and authors articles for DevCity. He is a moderator on VBCity and the MSDN Tech Forums and spends a lot of time answering technical questions there and in several other VB forum sites. Senior Editor for DevCity.NET, vbCity Developer Community Leader and Admin, and DevCity.NET Newsletter Editor. He has written and continues to tutor a number of free online courses for VB.NET developers.


View all articles by Ged Mead...

  This demonstration has used a very simple background task as its example, but you can use the same approach for more complex tasks.

   The BackgroundWorker makes it very easy to keep your application flowing while a time consuming, possibly CPU intensive, task is running in the background.  With the ReportProgress method you can give your users feedback as to what percentage of the task has completed (and optionally could of course use this value as a straightforward numeric value), together with visual notification, usually in the form of a text message .

  This very useful component shields you from the more technical intricacies and potential difficulties of using multithreading in your projects.  (However, if you do want more technical detail of multithreading, check out John Spano's article which you can read here.)

   I hope you'll find this introduction useful and will be able to use the techniques shown in projects of your own in the future.

  A sample application created using the Express Edition of VB 2008 is attached.  (If you prefer to use VB 2005 Express Edition or a full version of Visual Studio 2005, you can create a new project in VB 2005 and import the code files using the "Add Existing Item" menu choice.)



How would you rate the quality of this article?
1 2 3 4 5
Poor Excellent
Tell us why you rated this way (optional):

Article Rating
The average rating is: No-one else has rated this article yet.

Article rating:3.57500000000002 out of 5
 160 people have rated this page
Article Score42356
Sponsored Links