How to Convert String to Form ?

laufai

New member
Joined
Feb 1, 2005
Messages
1
Programming Experience
3-5
Hi ~

I am a Vb.Net Beginner , so I have a lot of question about it .......Hope anybody can help me......thx

My question is ......

i Create 2 form Called "Form1" and "Form2"

In Form1 , In a button Click event

Dim doform as String = "Form2"
But how can I convert String to Form ?
Just like the result :
Dim doform as new Form2
doform.Show()
 

cjaymcmeans

Well-known member
Joined
Jan 12, 2005
Messages
85
Programming Experience
3-5
you cant concert a string into a form...
well thats what i know..
what you can do is assign the string as the form name..

Dim x As New Windows.Forms.Form

x.Name = "Form2"

x.Show()
this worked...
hope this helps..
 

mzim

Well-known member
Joined
Jun 3, 2004
Messages
187
Location
Other side of the rock
Programming Experience
1-3
laufai said:
Hi ~

I am a Vb.Net Beginner , so I have a lot of question about it .......Hope anybody can help me......thx

My question is ......

i Create 2 form Called "Form1" and "Form2"

In Form1 , In a button Click event

Dim doform as String = "Form2"
But how can I convert String to Form ?
Just like the result :
Dim doform as new Form2
doform.Show()

just a question though.

why are trying to convert string to class???
form is a class.
what is the purpose of doing that thing?
why not go directly

Dim frm As New Form2()
frm.Show()

pls. give us feedback on what are you trying to achieve.
thnks.
 
Top Bottom