I am adding an array of buttons programmically and I have no idea on how to access the click procedure. Can anyone help me, Please?
This is for adding the buttons:
This is a sub with the events in it
Thanks for your help, in advance.
Electron
This is for adding the buttons:
Code:
Dim B(5) As Button
Dim int3 As Integer = 1
For int3 = 1 To 5
B(int3) = New Button()
Me.Controls.Add(B(int3))
B(int3).Size = New Size(50, 20)
B(int3).FlatStyle = FlatStyle.Standard
B(int3).Location = New Point(305, int3 * 25)
B(int3).Text = "Stats"
B(int3).Visible = True
B(int3).Name = "b" & int3
AddHandler B(int3).Click, AddressOf ClickHandler
Next
This is a sub with the events in it
Code:
Public Sub ClickHandler(ByVal sender As Object, ByVal e As System.EventArgs)
If sender.GetType.Name = "b1" Then
MsgBox("yes")
End If
End Sub
Thanks for your help, in advance.
Electron