|
-
Jun 20th, 2001, 02:38 AM
#1
Controls at runtime
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
-
Jun 20th, 2001, 02:46 AM
#2
Addicted Member
VB Code:
Form1.Controls.Add "VB.TextBox", "txtBox"
Will add a textbox called txtBox to form1
Computer /nm./: a device designed to speed and automate errors
-
Jun 20th, 2001, 02:49 AM
#3
Hyperactive Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|