BackgroundWorker.RunWorkerAsync Method (Object)

Starts running a background operation and includes a parameter for use by the background operation.

Namespace:  System.ComponentModel
Assembly:  System (in System.dll)

Syntax

'Declaration
Public Sub RunWorkerAsync ( _
    argument As Object _
)
public void RunWorkerAsync(
    Object argument
)

Parameters

  • argument
    Type: System.Object
    A parameter for use by the background operation in the DoWork event handler.

Exceptions

Exception Condition
InvalidOperationException

IsBusy is true.

Remarks

The RunWorkerAsync method submits a request to start the operation running asynchronously. When the request is processed, the DoWork event is raised, which in turn starts running your background operation.

If your background operation requires a parameter, you can provide it as the argument parameter to RunWorkerAsync.

If the background operation is already running, calling RunWorkerAsync again will raise an InvalidOperationException.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.