Hi
Got 42 buttons, and when any of them is pushed, the code should do the same,
I have collected them all in a Collection.
Dim DATOB As New Collection
When i push from 1 to 42 the code should run a SUB.
Dont want to make 42 buttons subs.
Got 42 buttons, and when any of them is pushed, the code should do the same,
I have collected them all in a Collection.
Dim DATOB As New Collection
Code:
Private Sub Form1_Load_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.BackColor = Color.LightGray
Button49.BackColor = Color.AliceBlue
Button50.BackColor = Color.Red
Button51.BackColor = Color.Green
Button52.BackColor = Color.Yellow
DATOB.Add(Button1)
DATOB.Add(Button2)
DATOB.Add(Button3)
DATOB.Add(Button4)
DATOB.Add(Button5)
DATOB.Add(Button6)
DATOB.Add(Button7)
DATOB.Add(Button8)
DATOB.Add(Button9)
DATOB.Add(Button10)
DATOB.Add(Button11)
DATOB.Add(Button12)
DATOB.Add(Button13)
DATOB.Add(Button14)
DATOB.Add(Button15)
DATOB.Add(Button16)
DATOB.Add(Button17)
DATOB.Add(Button18)
DATOB.Add(Button19)
DATOB.Add(Button20)
DATOB.Add(Button21)
DATOB.Add(Button22)
DATOB.Add(Button23)
DATOB.Add(Button24)
DATOB.Add(Button25)
DATOB.Add(Button26)
DATOB.Add(Button27)
DATOB.Add(Button28)
DATOB.Add(Button29)
DATOB.Add(Button30)
DATOB.Add(Button31)
DATOB.Add(Button32)
DATOB.Add(Button33)
DATOB.Add(Button34)
DATOB.Add(Button35)
DATOB.Add(Button36)
DATOB.Add(Button37)
DATOB.Add(Button38)
DATOB.Add(Button39)
DATOB.Add(Button40)
DATOB.Add(Button41)
DATOB.Add(Button42)
clearbuttons()
firstload()
End Sub
Code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
' HOW ?
End Sub