|
| Deleget.BeginInvoke.............missing? How do I make async delegate calls. Help! |
|
|
|
|
| Messages |
|
Related Types |
This message was discovered on microsoft.public.dotnet.languages.vb.
| Craig |
| GOOD ANSWER |
I need to make an asynchronous delegate call in vb and I noticied there is no BeginInvoke. It appears only the C# compiler supports this.
How do I make an async delegate calll???
By the way it appears that BeginInvoke for the Controls is not truly asynchronous either (at least when I process events via remoting)
|
|
|
| |
|
|
| |
| |
| VBDotNet Team [MS] |
| GOOD ANSWER |
Hi Craig,
To make an asynchronous delegate call in vb, you need to:
1) Declare a delegate function with same signature as the procedure 2) Create a procedure delegate instance from a procedure using the AddressOf operator 3) Call BeginInvoke on the delegate, passing in a callback function
Here's an example that asynchronously calls the Run method when the class DelegateTest is created
Class DelegateTest
Public Delegate Sub AsyncDelegate()
Public Sub New() Dim RunDelegate As AsyncDelegate = AddressOf Run RunDelegate.BeginInvoke(AddressOf Callback, RunDelegate) End Sub
Public Sub Callback(ByVal ar As IAsyncResult) ar.AsyncState.EndInvoke(ar) End Sub
Public Sub Run() System.Threading.Thread.Sleep(2000) End Sub
End Class
Hope this helps, Ernest and Sunder VB.NET
-- This posting is provided "AS IS" with no warranties, and confers no rights.
"Craig" <Click here to reveal e-mail address> wrote in message news:Click here to reveal e-mail address... [Original message clipped]
|
|
|
| |
|
|
| |
|
|
|
|
|
|
|
|
BootFX
Reliable and powerful .NET application framework. |
|
|
|
|
|
|