Hi,
i want some information about how to create VB Controls at runtime???
If anybody can explain that with an example(e.g textbox) that would be of great help...
regards..
preethi
Printable View
Hi,
i want some information about how to create VB Controls at runtime???
If anybody can explain that with an example(e.g textbox) that would be of great help...
regards..
preethi
VB Code:
Form1.Controls.Add "VB.TextBox", "txtBox"
Will add a textbox called txtBox to form1
Hi,
This example works with commandbuttons.
place a button on the form which you name 'cmdKnop' and set the index property to 0.
Then place the folowwing code behind a commandbutton:
dim br as integer
dim j as integer
br = 1200
For j = 1 To 10
Load cmdKnop(j)
With cmdKnop(j)
.Visible = True
.Top = 3480
.Left = br + 375
.Width = 375
.Caption = j
End With
br = br + 375
Next j
This example uses an array of commandbuttons, if you want to create controls without using an array, it's possible, but it is very difficult (i think) to add events to dynamically added controls without using an array.
Hope this helps