H o m e

 

Thread With The Visual Basic BackgroundWorker Class

8/27/2006 ThreadWithVisualBasicBackgroundWorkerClass.zip

Use the BackgroundWorker class, new in .NET 2.0, to create a BackgroundWorker object that can execute an operation on a separate thread. Processing on a separate thread makes it possible to maintain a responsive user interface while running a time consuming operation in the background.

A BackgroundWorker object can be created programmatically or by dragging it onto a form from the Components tab of the Toolbox.

Add a DoWork handler to listen for the BackgroundWorker object's DoWork event. Call the time-consuming operation in this event handler.

To receive and process notifications of background operation progress from the BackgroundWorker object, add an event handler to listen for the BackgroundWorker object's ProgressChanged events.

To receive and process the notification from the BackgroundWorker object that a background operation has completed, add an event handler to listen for the BackgroundWorker object's RunWorkerCompleted event.

Click the link above to download Visual Basic source code in a Visual Studio 2005 solution which demonstrates how to use the BackgroundWorker class to execute a background operation on a separate thread.

For more information visit the BackgroundWorker Class article on Microsoft's MSDN2 web site.

Get Dot Net Code is a web site full of free and pay for use Visual Basic source code for Visual Basic programmers.

 

Copyright © 2001-2006 aZ Software Developers. All rights reserved.

.