Help! how to add componts in a form at runtime
I defined a button in a class module, and try to create a button as bellow:
dim btnRead as vb.commandButton
Private Sub Class_Initialize()
' Set btnRead = New CommandButton ' invalid keyword "New"
' Set btnRead = createObject("vb.CommandButton") ' Can't create object
btnRead .Caption = "Read"
btnRead .index = indexCls ' indexCls is a public integer
End Sub
Public Property Let btn_left(pos As Integer)
btnRead.Left = pos
End Property
Public Property Let btn_top(pos As Integer)
btnRead .Top = pos
End Property
Public Property Let btn_Capt(capt As String)
btnRead .Caption = capt
End Property
This code is not work.
Can anybody help on how to add a run-time component in a form?
Thank you in advance.

