Can I dynamically(runtime) create a form/control? 
Author Message
 Can I dynamically(runtime) create a form/control?

You can create forms and controls at runtime, but they must be defined at
design time.  Say you had a form that acted as a text editor.  You can
create any number of these forms at run time for an MDI text editor for
example.  Same with controls.  You can create a single control and give it
an index and create many more to create a control array at runtime.  You
cannot simply create a form or control out of nothing.  Besides, there would
be no code behind it and you can't add code at runtime...

Try this:

' Create a form at design time called "Form1"

Public frmMain As Form    ' OR:  Public frmMain As Form1

Private Sub Main()

    ' Create a new Form1 and show it:
    Set frmMain = New Form1
    frmMain.Show

    ' .........

    ' Destroy the Form1 pointed to by frmMain:
    Set frmMain = Nothing

End Sub


Quote:
> Hi,

> Can I dynamically(at runtime) create a form or a control?
> That is not in the design mode.

> Also can I at runtime destroy a form or a control?
> Not just making it Enabled:False, Visible:False, etc.

> thanks



Wed, 18 Jun 1902 08:00:00 GMT  
 Can I dynamically(runtime) create a form/control?
Glenn,

VB6 introduced the ability to create controls 'out of thin air' at runtime.
See dynamic control creation in the What's new section of MSDN for VB6.

You can create forms, too, at runtime--even if they didn't exist at
designtime--but you have to use native Windows functionality.  See DevX (?)
for an example.

--A



Wed, 18 Jun 1902 08:00:00 GMT  
 Can I dynamically(runtime) create a form/control?
Hi,

Can I dynamically(at runtime) create a form or a control?
That is not in the design mode.

Also can I at runtime destroy a form or a control?
Not just making it Enabled:False, Visible:False, etc.

thanks



Wed, 18 Jun 1902 08:00:00 GMT  
 Can I dynamically(runtime) create a form/control?
'create a control with an index of 0

dim x as long
for x=1 to NumOfControls
    load Control(x)
    control(x).enabled=true
    control(x).visible=true
    'control(x).Left=Whatever
    'control(x).Top=Whatever
next x


Quote:

> > example.  Same with controls.  You can create a single control and give
it
> > an index and create many more to create a control array at runtime.  You

> Can you please give me some code to demostrate creating control array
> at runtime, thanks.



Wed, 18 Jun 1902 08:00:00 GMT  
 Can I dynamically(runtime) create a form/control?

Quote:

> example.  Same with controls.  You can create a single control and give it
> an index and create many more to create a control array at runtime.  You

Can you please give me some code to demostrate creating control array
at runtime, thanks.


Wed, 18 Jun 1902 08:00:00 GMT  
 Can I dynamically(runtime) create a form/control?

Quote:

>Glenn,

>VB6 introduced the ability to create controls 'out of thin air'
at runtime.
>See dynamic control creation in the What's new section of MSDN
for VB6.

Is this true? - I haven't found anything similar in the (german)
documentation, but I'm very interested in this subject. Could
you give me any more hints what to search for in the MSDN?

Thanks in advance

JoKi

-----------------------------------------------------------

Got questions?  Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com



Wed, 18 Jun 1902 08:00:00 GMT  
 Can I dynamically(runtime) create a form/control?

Quote:


> >Glenn,

> >VB6 introduced the ability to create controls 'out of thin air'
> at runtime.
> >See dynamic control creation in the What's new section of MSDN
> for VB6.

> Is this true? - I haven't found anything similar in the (german)
> documentation, but I'm very interested in this subject. Could
> you give me any more hints what to search for in the MSDN?

  I don't know if the VB Help index translates directly auf Deutsch - in
my English version, I find useful info in index under the topic:
Controls collection
  or: Add method (controls collection)
  As with some VB Help doc's, this one doesn't tell you everything, but
enough to get you started.
--
Jim in Cleveland
If you're writing to me, in my address
change "REAL_Address.see.below" to "worldnet.att.net"
 ((("What's so funny 'bout peace, love & understanding?" - Nick Lowe)))


Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Dynamically Creating Controls and Forms at runtime - HELP!!!!

2. Create a new form dynamically at runtime via strFormName

3. Create a new form dynamically at runtime via strFormName

4. deleting dynamically created controls in runtime using vb.net

5. Dynamically Creating Controls at Runtime

6. How do I create a canned form?

7. Dynamically adding a custom control to a form during runtime

8. Dynamically adding controls to a form at runtime

9. Creating Controls dynamically in Windows Forms

10. Creating controls on forms dynamically

11. How to dynamically create control on the form?

12. Dynamically creating controls (label, textbox...) on a form

 

 
Powered by phpBB® Forum Software