Create Controls at Runtime and Capture Events
No attachments for this post
This code will show you how to easily Create Controls at runtime and Capture there events 'With-out' useing API :).
This code will show you how to add a command button and display a message box when its clicked. Please Vote and Post Comments!!
Original Author: že7eN
'Here are some more control Names
Public WithEvents Command1 As CommandButton
Private Sub Command1_Click()
MsgBox "Button Pressed"
Private Sub Form_Load()
Set Command1 = Me.Controls.Add("VB.CommandButton", "Command1", Me)
.Visible = True
.Width = 900
.Height = 900
.Left = Me.Width / 2 - .Width / 2
.Top = Me.Height / 2 - .Height / 2
.Caption = "Test Button"
Comments on this post
No comments have been added for this post.
You must be logged in to make a comment.