views:

12

answers:

1

I have a list of buttons in VB2010.

What is the best way to assign a function to their click event.

So every button has the same function, e.g.:

 On Button Click
      FireFunction(1)
 End On Button Click

Without having to add a click event for every button.

The goal is to produce something similar to what is done with the Control Array idea in Visual Basic 2006.

+1  A: 

Define a click function as in: http://visualbasic.about.com/od/learnvbnet/a/eventhandler.htm and react based on Sender. There may be a cleaner way to setup delegates in VB.NET, but I use it not.

pst
Works perfectly, thanks!
jSherz