-
Public obj As Object
Private Sub Form_Click()
Set obj = CreateObject("VB.PictureBox")
End Sub
can someone tell me why this doesn't work on my comp? I have VB5 Ent edit, but it should work!
Option Explicit
Private WithEvents btnObj As CommandButton
Private Sub btnObj_Click()
MsgBox "This is a dynamically added button."
End Sub
Private Sub Form_Load()
Set btnObj = Controls.Add("VB.CommandButton", "btnObj")
With btnObj
.Visible = True
.Width = 3000
.Caption = "This button was created on the fly!"
.Top = 1000
.Left = 1000
End With
End Sub
This example didn't work either 438 - Object doesn't support this method on the Controls.Add method
-
You need vb6 to create controls at runtime. With vb5 you can only add controls to an existing control array.
-
I knew it! I knew it! I knew it! I knew it! I knew it! I knew it! I knew it! I knew it! I knew it!