Al,
In addition to the
Events in .NET any language are processed synchronously.
I believe because to be CLS compliant events do not return values, thus VB
does not allow a return value for an event. Also events by definition are
multicast, if the event returned a value how would each handler return its
value where there are more then one handler??
What I would do is follow the Event Pattern & define my event as a Sub with
Object & EventArgs parameters and make a custom EventArgs that has the
"return value" in it. (Similar to the
System.ComponentModel.CancelEventHandler)
Something like:
Public Class GetDataEventArgs
Inherits EventArgs
Private m_data As Integer
Public Property Data() As Integer
Get
Return m_data
End Get
Set(ByVal value As Integer)
m_data = value
End Set
End Property
End Class
Public Delegate Sub GetDataHandler(ByVal sender As Object, ByVal e As
GetDataEventArgs)
Public Class MyProcess
Public Event GetData As GetDataHandler
Protected Overridable Sub OnGetData(ByVal e As GetDataEventArgs)
RaiseEvent GetData(Me, e)
End Sub
Public Sub Process()
Dim e As New GetDataEventArgs
OnGetData(e)
If e.Data = 100 Then
' do something interesting
End If
End Sub
End Class
Hope this helps
Jay
"Al" <Al@discussions.microsoft.com> wrote in message
news:BD**********************************@microsof t.com...
Hi,
I believe that when an event is Raised is C#, it is performed
synchronously, as a value is returned by the event handler, even if that
value is NULL. However, as VB does not have the ability to receive a return
value, I was wondering is the call was performed asynchronously, rather than
blocking on a call for which it would not receive a response.
I was specifically thinking of the case of having a cient subscribing to
the event in a server, and the server being present in a remote machine.
Al