How to pass Button.Click into a function?
Posted
by Achilles
on Stack Overflow
See other posts from Stack Overflow
or by Achilles
Published on 2010-03-15T13:55:35Z
Indexed on
2010/03/15
13:59 UTC
Read the original article
Hit count: 138
.NET
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!
© Stack Overflow or respective owner