Open a form using a string

G

Guest

Hi all,
is there any way to open a form (create an instance) when its name is stored
in a string variable?

By the way, in other post, someone wrote that datagrid is mostly used with
datasets/datatables rather than arraylists. My question is, in either cases I
must set up columns, don't I? (assuming I want to personalize those columns)

TIA,
DC
 
H

Herfried K. Wagner [MVP]

DC said:
is there any way to open a form (create an instance) when its name is
stored
in a string variable?

\\\
Dim frm As Form = _
DirectCast( _
Activator.CreateInstance( _
Type.GetType("MyApplication.SampleForm") _
), _
Form _
)
frm.Show()
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top