Load a form

VB 6
i have a textbox
in this the user will type name of a form
 

i have to show the form

i do not want to check each form's name
with the name in the textbox

i want some other logic
Siva111599Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TimCotteeHead of Software ServicesCommented:
There is no easy way of doing this, perhaps an alternative method would be to create a combobox which you fill with the valid form names either by iterating through the forms collection or otherwise.
0
caraf_gCommented:
In VB6 + SP3:

Forms.Add "Form2"

Dim objForm As Form
Set objForm = Forms(Forms.Count - 1)
objForm.Show

With thanks to ameba.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
caraf_gCommented:
or...

Forms.Add YourTextBox.Text
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

caraf_gCommented:
PS

You'll have great fun distinguishing between multiple instances of the same form ;-)
0
TimCotteeHead of Software ServicesCommented:
Didn't think about that one, but I agree it will be great fun trying to find out which form is which!

0
caraf_gCommented:
..and if you were to increase the number of points to a decent amount I'll even tell you how.
0
lmartin080698Commented:
You can't add to the forms collection !!!!!!!!!!!!!!

Declare a custom collection at module level
mcolForms as New Collection


'on form load ...
dim objForm as form
for each objForm in Forms
  mcolForms.Add objForm,objForm.Name
next objForm

'Then, when the user types a form name,
'retrieve the form by using ...

mcolForms(txtForm.Text)

'Use error handling in case they typed
'a name that does not exist in the 'collection.

On error goto ?
0
Éric MoreauSenior .Net ConsultantCommented:
Look in the help for CallByName.
0
caraf_gCommented:
You can't add to the forms collection !!!!!!!!!!!!!!

Yes you can, in VB6 + SP3. New feature, very nice!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.