Terry,
Have you tried the code?
All the handlers attached to the Closing event will finish running then the
socket itself will be closed. Hence Closing should pass a class derived
from System.ComponentModel.CancelEventArgs so that event handlers have a
chance to cancel closing the
Something like:
Dim e as New CancelEventArgs()
RaiseEvent Closing(me, e)
If e.Cancel Then Exit Sub
mySocket.Close()
RaiseEvent Closed(me, EventArgs.Empty)
Of course the two RaiseEvent statements should be wrapped in protected
overridable On<Event> subs per the "Design Guidelines for Class Library
Developers":
http://msdn.microsoft.com/library/de...Guidelines.asp http://msdn.microsoft.com/library/de...Guidelines.asp
Note: within VB.NET you can simply use RaiseEvent rather then checking to
see if a delegate variable is Nothing and invoking the delegate variable...
Hope this helps
Jay
"Terry Olsen" <to******@hotmail.com> wrote in message
news:e2**************@TK2MSFTNGP10.phx.gbl...
Will the 2nd line in the following code execute immediately? Or will it
wait until the event handler finishes?
RaiseEvent Closing()
mySocket.Close()