Private Declare Function SetParent Lib "user32" (ByVal HwndChild As Long, ByVal HWndNewParent As Long) As Long
Dim WithEvents NewCommand As CommandButton
Private Sub Command1_Click()
If NewCommand Is Nothing Then
Set NewCommand = Controls.Add("VB.CommandButton", "CommandAdd", Me)
NewCommand.Caption = "ADFASDF"
SetParent NewCommand.hWnd, Picture1.hWnd
NewCommand.Move 100, 100
NewCommand.Visible = True
End If
End Sub
Private Sub NewCommand_Click()
MsgBox NewCommand.Caption
End Sub