CodeItBetter Programming Another VB Programming Blog

How to create Controls in a form runtime (without creating in design time)

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
'Controls - How to create Controls in a form runtime (without creating in design time)
Option Explicit
 
Dim WithEvents cmdTest As VB.CommandButton
 
Private Sub Form_Load()
    Set cmdTest = Controls.Add("VB.CommandButton", "cmdTest", Me)
    cmdTest.Move 100, 100
    cmdTest.Caption = "Hello"
    cmdTest.visible = True
End Sub
 
Private Sub cmdTest_Click()
    MsgBox "Hi There!"
End Sub
Filed under: Controls Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.