by Raghu (22 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 19th November 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Simple Code to Create a Control Dynamically with events
API Declarations
'[email protected]
'You Can create any controls with this method
'by declaring a object to the appropriate controls
Public WithEvents Cmd as CommandButton
Set Cmd = Me.Controls.Add("VB.CommandButton","Command1")
With Cmd
.Enabled = true
.top = 2000
.left = 2000
.height = 450
.width = 2500
.caption = "Click"
.visible = True
End With
End Sub
Private Sub Cmd_Click()