Control.BeginInvoke Method (Delegate)
Executes the specified delegate asynchronously on the thread that the control's underlying handle was created on.
[Visual Basic] Overloads Public Function BeginInvoke( _ ByVal method As Delegate _ ) As IAsyncResult [C#] public IAsyncResult BeginInvoke( Delegate method ); [C++] public: IAsyncResult* BeginInvoke( Delegate* method ); [JScript] public function BeginInvoke( method : Delegate ) : IAsyncResult;
- A delegate to a method that takes no parameters.
An IAsyncResult object that represents the result of the BeginInvoke operation.
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.
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family