The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
DoWorkEventArgs Class
.NET Framework 3.0
Provides data for the DoWork event handler.
Namespace: System.ComponentModel
Assembly: System (in system.dll)
Assembly: System (in system.dll)
The following code example demonstrates how to use the DoWorkEventArgs class to handle the DoWork event. For a full code listing, see How to: Run an Operation in the Background.
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { // Do not access the form's BackgroundWorker reference directly. // Instead, use the reference provided by the sender parameter. BackgroundWorker bw = sender as BackgroundWorker; // Extract the argument. int arg = (int)e.Argument; // Start the time-consuming operation. e.Result = TimeConsumingOperation(bw, arg); // If the operation was canceled by the user, // set the DoWorkEventArgs.Cancel property to true. if (bw.CancellationPending) { e.Cancel = true; } }
System.Object
System.EventArgs
System.ComponentModel.CancelEventArgs
System.ComponentModel.DoWorkEventArgs
System.EventArgs
System.ComponentModel.CancelEventArgs
System.ComponentModel.DoWorkEventArgs
Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.Community Additions
Show: