per vb6

Option Explicit
Private WithEvents butt As CommandButton

Private Sub butt_Click()
MsgBox "aggiunto in run-time(o come dici tu: dal nulla)"
End Sub

Private Sub Form_Load()
Set butt = Controls.Add("VB.CommandButton", "butt")
With butt
.Visible = True
.Width = 2000
.Caption = "Prova"
.Top = 1000
.Left = 1000
End With
End Sub



per vb.net

'dichiara il bottone
Private WithEvents butt As New Button()

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Controls.Add(butt)
With butt
.Text = "Prova"
.Location = New Point(50, 50)
End With
End Sub


Private Sub butt_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles butt.Click
MsgBox("aggiunto in run-time(o come dici tu: dal nulla)")
End Sub