Reputation: 4079
In continuation of this question. Does VB.NET supports virtual events?
Upvotes: 0
Views: 643
Reputation: 755141
No. This is something we've looked into supporting but did not meet our current bar in the given language cycle.
Yes. You can use the Custom event syntax to allow for hierarchy controlled eventing.
MustInherit Class Base
Public Custom Event Event1 As EventHandler
AddHandler(ByVal value As EventHandler)
AddEvent1(value)
End AddHandler
RemoveHandler(ByVal value As EventHandler)
RemoveEvent1(value)
End RemoveHandler
RaiseEvent(ByVal sender As Object, ByVal e As System.EventArgs)
RaiseEvent1(sender, e)
End RaiseEvent
End Event
Protected MustOverride Sub AddEvent1(ByVal value As EventHandler)
Protected MustOverride Sub RemoveEvent1(ByVal value As EventHandler)
Protected MustOverride Sub RaiseEvent1(ByVal sender As Object, ByVal e As EventArgs)
End Class
Upvotes: 4