|
-
April 9th, 2001, 08:58 AM
#1
Convert string to form
I am not sure about which category to put this in. Anyway, what I am trying to do is this. I have names of forms stored in a database and want to use these values to load the forms. In order to keep from hard coding anything in the program, I want to accept the string from the database, convert the string value to a form object, and then load the form. Then I can get the window handle, which is really why I am going through this song and dance to begin with. Any ideas, let me know.
Thanks in advance,
[email protected]
-
April 9th, 2001, 09:53 AM
#2
Re: Convert string to form
This is Bruno solution to this matter.
Use Add method of Forms collection:
Forms.Add("Form1").Show
You'll need VB6 SP3 for Forms.Add to work. Without SP3 it won't work when compiled.
option Explicit
private Sub Form_Click()
Dim x as Form, strName as string
strName = "Form1"
set x = Forms.Add(strName)
x.Show
End Sub
Hope it help you too
Cesare Imperiali
Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
April 9th, 2001, 10:23 AM
#3
Re: Convert string to form
Well, I am running VB6 with SP4 and I can't get ths Forms.Add to work. I get error 424, object required. Any hints to make this work?
-
April 9th, 2001, 10:33 AM
#4
Re: Convert string to form
Never mind. I had something typed wrong. That works great. Thanks so much!!!!
-
April 9th, 2001, 11:08 AM
#5
Re: Convert string to form
Thanks to Bruno (we will miss him).
Best regards,
Cesare Imperiali
Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
January 20th, 2006, 07:45 AM
#6
Re: Convert string to form
Dear Cimperiali
thank u very much, it work properly
Deepak
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|