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()
 
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..
 
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.
 
Back
Top