Nota: esta propiedad es nueva en la versión 2.0 de .NET Framework.
Obtiene un valor que representa el argumento de una operación asincrónica.
Espacio de nombres: System.ComponentModel
Ensamblado: System (en system.dll)
Visual Basic (Declaración)
Public ReadOnly Property Argument As Object
Dim instance As DoWorkEventArgs
Dim value As Object
value = instance.Argument
public Object Argument { get; }
public:
property Object^ Argument {
Object^ get ();
}
/** @property */
public Object get_Argument ()
public function get Argument () : Object
Valor de propiedad
Objeto Object que representa el argumento de una operación asincrónica.
En el ejemplo de código siguiente se muestra cómo utilizar la clase DoWorkEventArgs para controlar el evento DoWork. Para obtener una lista de código completa, vea Cómo: Ejecutar una operación en segundo plano.
Private Sub backgroundWorker1_DoWork( _
sender As Object, e As DoWorkEventArgs) _
Handles backgroundWorker1.DoWork
' Do not access the form's BackgroundWorker reference directly.
' Instead, use the reference provided by the sender parameter.
Dim bw As BackgroundWorker = CType( sender, BackgroundWorker )
' Extract the argument.
Dim arg As Integer = Fix(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 Then
e.Cancel = True
End If
End Sub
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;
}
}
Windows 98, Windows 2000 SP4, Windows Millennium, Windows Server 2003, Windows XP Media Center, Windows XP Professional x64, Windows XP SP2, Windows XP Starter Edition
.NET Framework no admite todas las versiones de cada plataforma. Para obtener una lista de las versiones admitidas, vea Requisitos del sistema.
.NET Framework
Compatible con: 2.0