To add a button dynamically:

Code:
Private Sub Command1_Click()

	Controls.Add "VB.CommandButton", "Button1"
	Me!Button1.Move 0, 0
	Me!Button1.Caption = Text1
	Me!Button1.Visible = True

End Sub
But in this case, it's probably best to load them out of a Control Array. You make them stay on the App by saving them to the Registry when they are created, then simply loading them when the App is loaded again.

Make a Form with a 2 CommandButton's and a TextBox. Call 1 of the CommandButton's Buttons and set it's index property to 0.

Code:
Private Sub Command1_Click()
    
    iCount = Buttons.Count
    Load Buttons(iCount)
    Buttons(iCount).Move 0, 0
    Buttons(iCount).Caption = Text1.Text
    Buttons(iCount).Visible = True
    
    SaveSetting "MyApp", "MySection", "ButtonCount", iCount
    SaveSetting "MyApp", "Button", iCount, Text1.Text

End Sub

Private Sub Form_Load()

    iCount = GetSetting("MyApp", "MySection", "ButtonCount")
    Print iCount
    For i = 1 To iCount
        MsgBox (i)
        Load Buttons(i)
        Buttons(i).Move 0, 0
        Buttons(i).Caption = GetSetting("MyApp", "Button", i)
        Buttons(i).Visible = True
    Next i
    
End Sub



[Edited by Megatron on 07-27-2000 at 08:30 PM]