Public Class Form1
Dim NButtons As Byte = 9 ' qui quanti bottoni intendi realizzare
Dim btn(NButtons) As Button ' matrice di bottoni con indice
Dim frm(NButtons) As Form ' matrice di form con indice
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
For f As Byte = 1 To NButtons
btn(f) = New Button
btn(f).Name = "bottone " & f.ToString("00")
btn(f).Text = "btn" & f
btn(f).Tag = f ' per recuperare l'indice nell'evento click
btn(f).Location = New Point(10, f * 25) ' colonna 10, riga progressiva
' .... tutte le altre proprietà che ti occorrono
Me.Controls.Add(btn(f)) ' aggiunge il bottone al Form
' bisoga aggiungere anche l'evento click
AddHandler btn(f).Click, AddressOf btn_OnClick
' creo i form vuoti, ci metterai quello che ti serve
frm(f) = New Form
frm(f).Text = "Sono il form " & f
frm(f).ShowInTaskbar = False
Next f
End Sub
Private Sub btn_OnClick(ByVal sender As System.Object, ByVal e As System.EventArgs)
' In sender tutte le proprietà del bottone cliccato
' Top, Left o Location, Hight, Width o Size ecc ecc
' 2 esempi per avere l'indice e il nome
Dim IndiceBottone As Byte = sender.tag()
Dim NomeBottone As String = sender.name
Me.Text = "Indice = " & IndiceBottone.ToString & " - " & NomeBottone
' mostro il form in accordo con il bottone cliccato
If frm(IndiceBottone).Text = "" Then
' ricreo il form se chiuso
frm(IndiceBottone) = New Form
frm(IndiceBottone).Text = "Sono il form ricreato" & IndiceBottone
frm(IndiceBottone).ShowInTaskbar = False
frm(IndiceBottone).Show()
Else
frm(IndiceBottone).Show()
End If
End Sub
End Class