Export (0) Print
Expand All

Control.BeginInvoke Method (Delegate, Object[])

.NET Framework 1.1

Executes the specified delegate asynchronously with the specified arguments, on the thread that the control's underlying handle was created on.

[Visual Basic]
Overloads Public Overridable Function BeginInvoke( _
   ByVal method As Delegate, _
   ByVal args() As Object _
) As IAsyncResult Implements ISynchronizeInvoke.BeginInvoke
[C#]
public virtual IAsyncResult BeginInvoke(
 Delegate method,
 object[] args
);
[C++]
public: virtual IAsyncResult* BeginInvoke(
 Delegate* method,
 Object* args __gc[]
);
[JScript]
public function BeginInvoke(
   method : Delegate,
 args : Object[]
) : IAsyncResult;

Parameters

method
A delegate to a method that takes parameters of the same number and type that are contained in the args parameter.
args
An array of objects to pass as arguments to the given method. This can be null if no arguments are needed.

Return Value

An IAsyncResult object that represents the result of the BeginInvoke operation.

Implements

ISynchronizeInvoke.BeginInvoke

Remarks

The delegate is called asynchronously, and this method returns immediately. You can call this method from any thread, even the thread that owns the control's handle. If the control's handle does not exist yet, this method searches up the control's parent chain until it finds a control or form that does have a window handle. If no appropriate handle can be found, BeginInvoke will throw an exception. Exceptions within the delegate method are considered untrapped and will be sent to the application's untrapped exception handler.

Note   The BeginInvoke method calls the specified delegate back on a different thread pool thread. You should not block a thread pool thread for any length of time.
Note   There are four methods on a control that are safe to call from any thread: Invoke, BeginInvoke, EndInvoke, and CreateGraphics. For all other method calls, you should use one of the invoke methods to marshal the call to the control's thread.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Control Class | Control Members | System.Windows.Forms Namespace | Control.BeginInvoke Overload List | IAsyncResult | EndInvoke | Invoke | CreateGraphics | InvokeRequired

Show:
© 2014 Microsoft