You can efficiently add handle your button's click event
during runtime like this,
I assume that you are having your buttons
inside a panel
called PnlBtns
.
'Traversing through panel and adding a common handler for buttons
For each ctrl in PnlBtns.controls
If TypeOf ctrl is button then
AddHandler ctrl.Click, AddressOf CommonClickHandler
end if
Next
'Common Handler for all of your buttons.
Private Sub CommonClickHandler(ByVal sender As System.Object, ByVal e As System.EventArgs)
MsgBox(ctype(sender,button).text)
End Sub