I have a function that adds eventhandlers to control events. Right now I have several overloads that add events to different types of controls:
Public Sub AddEventHandler(Button, ButtonEvent) 'adds event handling for Button.Click
public Sub AddEventHandler(LinkButton, ButtonEvent)'adds event handling for LinkButton.Click
The problem is I want to write a function that is more robust like:
Public sub AddEventHandler(Control, EventToHandle, ControlEvent)
where
EventToHandle is the parameter representing Button.Click or whatever event that Button has associated with it.
Any suggestions guys? Thanks!
You still can do something like this:
And using:
But I don’t think it is better then actually subscribing to the event.