Question re Event Publishing

M

Mike hofer

I am studying up for my MCAD, and came across an interesting conundrum.
According to my textbook, there are FOUR steps to publish an event:

1. Define a delegate type that specifies the prototype of the event handler.
If the event generates no data, use the predefined EventHandler delegate.
2. Define an event based on the delegate type defined in the preceding step.
3. Define a protected, virtual method that raises the event.
4. When the event occurs int he environment, invoke the protected, virtual
method defined in the preceding step.

Now, the sample that illustrates these steps includes the following code,
which is run on the server:

' ----------------
' Begin Publishing
' ----------------

' Define the event
Public Event MyEvent As EventHandler

' Notify the registered objects of the event
Protected Sub OnMyEvent(ByVal e As eventargs)
RaiseEvent MyEvent(Me, e)
End Sub

' Raise MyEvent when the page is loaded
Protected Overrides Sub OnLoad(ByVal e As eventargs)
OnMyEvent(e)
MyBase.OnLoad(e)
End Sub

' --------------
' End Publishing
' --------------

I can clearly see steps 1, 3, and 4 in the code. Where the blazes is step 2?
I have looked at this until I'm blue in the face. I missed this question on
the review exercises because I based my answers on the steps I coded, and I
clearly don't see a step 2.

Any help you guys could provide would be greatly appreciated.

(For your information, the book in question is MCAD/MCSD Developing and
Implementing Web Applications with Visual Basic .NET and Visual Studio .NET
by Mike Gunderloy, published by Que Certification.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,539
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top