Dynamic Creation of Object Names - Forms 
Author Message
 Dynamic Creation of Object Names - Forms

Is there a way in VB4 to dynamically create the name of an object you
want to load or show?


I have a form named frm_DataForm.

I want to show the form - frmDataForm.Show (OK)

But I want to do this in code using a variable for the form name -

So, how do I create the name in a variable. I have tried setting a
variable to a variant, form, object, etc. When I try this I get an
error having to do with object does not exists.

dim FormToLoad as object

set formtoload = "frm_" & somevariablewithendofformname

formtolaod.show (eeent - not an object)

This was called a Macro in some other languages I have used but I
can't seem to find anything in VB that will work.


Tue, 16 Apr 2002 03:00:00 GMT  
 Dynamic Creation of Object Names - Forms
The only solution I could come up in 5 minutes is the following, and I
am not sure if it works under VB4 :-)

Dim MyForm As New frm_DataForm

    If ("frm_" & somevariablewithendofformname = MyForm.Name) Then

I know this is not perfect, but give it a bash until someone brighter
comes up with a solution.

Gavin Huet

Sent via Deja.com http://www.deja.com/
Before you buy.

Tue, 16 Apr 2002 03:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. dynamic form name creation

2. Request Object and dynamic form item names

3. Dynamic creation of variable names

4. dynamic object creation in VB4

5. Dynamic creation of ole object

6. Dynamic Object creation

7. Dynamic object creation at run-time...

8. Dynamic object creation at run-time...

9. dynamic creation of a textbox object

10. Dynamic object creation license

11. Dynamic Control Creation, Controls object has no .Add ???

12. dynamic creation of an object type


Powered by phpBB® Forum Software