Mozda ti ovo bude od koristi:
Code:
Public Class Form1
Dim button(5) As Button
Friend WithEvents Button1 As System.Windows.Forms.Button
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim i, x, y As Integer
x = 0
y = 0
For i = 0 To (Button.Length - 1)
Button(i) = New System.Windows.Forms.Button
Button(i).Location = New System.Drawing.Point(x, y)
Button(i).Name = "Button" & i
Button(i).Size = New System.Drawing.Size(50, 50)
Button(i).TabIndex = 0
Button(i).Text = "Button" & i
Me.Controls.Add(Button(i))
AddHandler Button(i).Click, AddressOf Me.Button1_Click
x += 50
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MsgBox(sender.Text)
End Sub
End Class
Poz
sale