Event

To define an event in VB .NET you must declare its signature. You can either use a delegate as a type for this event or define the signature on the event itself. Both declarations can be mixed in a class.

The delegate used as a type is represented by an attribute with the <<Event>> stereotype. You define the delegate name using the attribute data type.



Public Class Printer
 Public PaperJam As EventHandler
 Public OutOfPaper As EventHandler
 Public JobOK As PrinterGoodDelegate
End Class

When you define the signature on the event itself, you have to use an operation with the <<Event>> stereotype. The signature of this operation then becomes the signature of the event.



Public Class Printer
 Public Event PaperJam(ByVal p As Printer, ByVal e As EventArgs)
 Public Event JobOK(ByVal p As Object)
End Class

Event Implementation

To design the implementation clause of a delegate used as a type you have to type a clause in the implements extended attribute of the <<Event>> attribute.

For <<Event>> operations, you have to use the To Be Implemented feature in the list of operations of the class.


Created October 7, 2009. Send feedback on this help topic to Sybase Technical Publications: pubs@sybase.com