|
-
July 13th, 2001, 02:22 AM
#1
dynamically creating a dialog
Is it possibel to create a dialog at runtime.
More precise, can I create an control, like a
button, listbox, etc. , and place it on a
form at runtime?
thank´s hannes
[email protected]
-
July 13th, 2001, 03:28 AM
#2
Re: dynamically creating a dialog
Prior to VB.Net you can only create a control by loading an instance of an existing control array.
For example, suppose you want a form with 20 buttons on it - you create a form with 1 button on it and set it's Index property to zero.
Then to load the others dynamically:
private Sub Form_Load()
Dim lIndex as Long
for lIndex = 1 to 10
Load Command1
command1(lindex).Caption = "Button " & lindex
command1(lIndex).Left = (Comman1(lIndex-1).Left + Command1(lIndex).width)
Command1(lIndex).Visible = true
next lIndex
End Sub
In VB.Net you can just create new controls willy-nilly at run time....(If you can keep the IDE running long enough so to do)
HTH,
Duncan
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
-
July 13th, 2001, 09:43 AM
#3
Re: dynamically creating a dialog
There is a way to create a single control at run time. Unfortunately, you can't ceate control arrays using this method with VB6.0 and earlier.
There are simulated control array creation methods available. There is an example of Collection of class Objects posted on this forum By Cesare Cimperiali that performs this magic
http://63.236.73.79/cgi-bin/bbs/wt/s...age=5&Limit=25
John G
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
|