I got a button array of 40 buttons
And i handle all the button events in 1 sub .
But i need to know what button is pressed.
Can someone help me ?
Private bttonArray(41) As Button
Public Sub Hoofdscherm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
REM place the Buttons in a array
bttonArray(1) = Button1
bttonArray(2) = Button2
bttonArray(3) = Button3
bttonArray(4) = Button4
bttonArray(5) = Button5
bttonArray(6) = Button6
bttonArray(7) = Button7
bttonArray(8) = Button8
bttonArray(9) = Button9
bttonArray(10) = Button10
bttonArray(11) = Button11
bttonArray(12) = Button12
bttonArray(13) = Button13
bttonArray(14) = Button14
bttonArray(15) = Button15
bttonArray(16) = Button16
bttonArray(17) = Button17
bttonArray(18) = Button18
bttonArray(19) = Button19
bttonArray(20) = Button20
bttonArray(21) = Button21
bttonArray(22) = Button22
bttonArray(23) = Button23
bttonArray(24) = Button24
bttonArray(25) = Button25
bttonArray(26) = Button26
bttonArray(27) = Button27
bttonArray(28) = Button28
bttonArray(29) = Button29
bttonArray(30) = Button30
bttonArray(31) = Button31
bttonArray(32) = Button32
bttonArray(33) = Button33
bttonArray(34) = Button34
bttonArray(35) = Button35
bttonArray(36) = Button36
bttonArray(37) = Button37
bttonArray(38) = Button38
bttonArray(39) = Button39
bttonArray(40) = Button40
For x = 1 To 40
AddHandler bttonArray(x).Click, AddressOf Button_Click
bttonArray(x).Show()
bttonArray(x).Size = New Size(80, 23)
Next x
End Sub
Rem button click sub
Private Sub Button_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Rem now i need to know then button number
bttonArray(This number i need).Text = "click"
End Sub