Doh!!
That should be:
| Protected Overridable Sub OnSomeNotificat ion(ByVal e As EventArgs)
| RaiseEvent SomeNotificatio n(Me, e)
| End Sub
Obviously the OnSomeNotificat ion raises the SomeNotificatio n event & not the
AbortAll event as I showed. ;-)
--
Hope this helps
Jay [MVP - Outlook]
T.S. Bradley -
http://www.tsbradley.net
"Jay B. Harlow [MVP - Outlook]" <Ja************ @tsbradley.net> wrote in
message news:ex******** ******@TK2MSFTN GP12.phx.gbl...
| **Developer**
| In addition to the other comments:
|
| I normally define my events as:
|
| Public Event SomeNotificatio n As EventHandler
|
| As EventHandler is a Delegate that is defined with the sender & e
| parameters. Indirectly this minimizes the number of Delegates that are
| defined. If you define your event as:
|
| Public Class Something
| Public Event SomeNotificatio n (ByVal sender As Object, ByVal e As
| EventArgs)
| End Class
|
| Then VB creates a hidden Delegate for you, which you see in ILDASM.EXE as
| Something.SomeN otificationEven tHandler.
|
| If you have a lot of events like SomeNotificatio n, then you wind up with a
| lot of Delegate types that are defined identically, leading to Assembly
| bloat...
|
|
| I normally call an OnSomeNotificat ion sub to raise the event.
|
| OnSomeNotificat ion(EventArgs.E mpty)
|
| When I raise the event, where OnSomeNotificat ion is defined as:
|
| Protected Overridable Sub OnSomeNotificat ion(ByVal e As EventArgs)
| RaiseEvent AbortAll(Me, e)
| End Sub
|
| Using OnSomeNotificat ion allows derived classes to both raise the event &
to
| add code before and/or after the event is raised. Normally I simply
override
| OnSomeNotificat ion to allow a derived class to simply handle the event,
| rather then using AddHandler...
|
|
| The above event pattern is defined at:
|
|
http://msdn.microsoft.com/library/de...guidelines.asp
| and
|
http://msdn.microsoft.com/library/de...Guidelines.asp
|
|
| --
| Hope this helps
| Jay [MVP - Outlook]
| T.S. Bradley -
http://www.tsbradley.net
|
|
| " **Developer**" <RE************ *@a-znet.com> wrote in message
| news:e%******** ********@TK2MSF TNGP12.phx.gbl. ..
||I always define events with the parameters
||
|| ByVal sender As Object, ByVal e As EventArgs
||
|| Even if they are not used.
||
|| Seems I read someplace that's the thing to do.
||
|| So I then do:
||
|| RaiseEvent AbortAll(Nothin g, Nothing)
||
|| Does that make sense to you?
||
|| Is that the standard practice?
||
||
||
||
||
|| Thanks
||
||
|
|