Question Locked

VB: form name in variable

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

During runtime I get the name of the form that has to open in a string variable. How do I open this form?

example:
dim tmpForm as string
tmpForm = xxxx ' Given during runtime
xxxx.show() ' xxxx must be a form object here

So the question is how to create a object of the form when you know the formname during runtime?

2 replies

by tony hopkinson

There is a collection called forms which contains a list of all the loaded forms in the application.

If you google VB6 forms collection, you'll get lots of help how to use it.

If this is VB.Net, there's no such animal, found this though.

http://www.fawcette.com/vsm/2002_12/online/hottips/lobel/

If it is .net you could use reflection's getmethod method, instead.

I did 18 months at Infonet/AUCS out at Hoofdoorp, how is the place.

Tot Ziens !

This discussion is closed to new replies.