Link to home
Start Free TrialLog in
Avatar of daniel_j_c
daniel_j_c

asked on

createobject to instance a vb6 form?

Hi

Is there any way to instance a vb6 form using only the name of the form in vb6?

eg: set frm = createobject("form1")

(this doesn't work)

I want to be able to instance a form from it's name which will be stored in a string.
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

trY:

dim frm as form1
set frm = new form1
...
Avatar of daniel_j_c
daniel_j_c

ASKER

ok, here's a little background...

I want to be able to store the names of forms in a database in a "tasks" table. The tasks table has the name of the form to be instanced and an associated task name eg:

Form                    Task Name
frmclientdetails      New Client

I want to be able to create an instance of the form frmclientdetails using the string "frmclientdetails". I can't use "= new frmclientdetails" because that would require me to create a select case statement like this:

select case FormName
case "frmclientdetails": set frm=new frmclient details
...
end select

Which is why I want to use something like createobject().
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
can't believe it's that simple! i've been looking for something like this for years!