1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| Sub creeForm()
'variables
Dim frm As Form
Dim ctlLabel As Control, ctlText As Control
Dim tv As treeview
Dim treeview As Control
Dim nodex As node
'création du formulaire
Set frm = CreateForm
'création des contrôles
Set ctlText = CreateControl(frm.Name, acTextBox, , "", "", 1000, 100)
ctlText.Name = "txt"
Set ctlLabel = CreateControl(frm.Name, acLabel, , ctlText.Name, "Texte", 10, 100)
Set ctlButton = CreateControl(frm.Name, acCommandButton, , , "bt1", 3000, 100)
ctlButton.Caption = "Hello"
'instanciation du treeview
Set pc = CreateControl(frm.Name, acCustomControl, , , "", 600, 600)
pc.Class = "MSComctlLib.TreeCtrl.2"
pc.OLEClass = "TreeCtrl"
pc.Name = "treeview"
pc.Enabled = True |
Partager