When one extends a class, how is the proper way of setting code to be executed upon some event of the base class?Should one handle the base class event this way:Public Class Class2    Inherits Class1    Private Sub MyBase_MyEvent(sender as object, e as eventargs) Handles MyBase.MyEvent        ' do stuff here    End SubEnd ClassOr should one override the event caller sub?Public Class Class2    Inherits Class1    Protected Overrides Sub OnMyEvent(e as EventArgs)        MyBase.OnMyEvent(e)        ' do stuff here    End SubEnd ClassThank you very much
How to handle events in extended classes?
.net;inheritance;event programming;vb.net
Both options are fine and common.  The big difference: with option 1, you can't necessarily tell what order the handlers are fired in, while with the second option, you can decide whether MyBase.OnMyEvent is called before or after your overridden implementation.