Deleget.BeginInvoke.............missing??? How do I make async delegate calls. Help! 
Author Message
 Deleget.BeginInvoke.............missing??? How do I make async delegate calls. Help!

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)



Tue, 01 Feb 2005 02:41:48 GMT  
 Deleget.BeginInvoke.............missing??? How do I make async delegate calls. Help!
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.


Quote:
> 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)



Tue, 01 Feb 2005 04:35:01 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Sending e-mail from a delegate called with BeginInvoke

2. somebody know a way to delegate events async?

3. Async Delegate Callback problem, pls help

4. Move data from a shared cal to default cal

5. Delegates - What am I missing???

6. DIRE NEED OF HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

7. REQ,,,,,,,H E L P.........WITH -----V--B-4-0-- & MAKING WAVE SOUND UTILITIES ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

8. to delegate or not to delegate?

9. microsoft.public.dotnet.languages.vb missing?

10. HIDDEN FILE....PS..................................................................................................

11. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!ATTENTION!!!!!!!!!!!!!!!!!!!!!!!!!!!

 

 
Powered by phpBB® Forum Software