[C#]
try
{
Assembly tempAssembly = Assembly.GetExecutingAssembly();
Form frm1 = (Form) tempAssembly.CreateInstance(textBox1.Text);
frm1.Show();
}
catch(Exception ex)
{
MessageBox.Show(''Error creating: ''+ textBox1.Text);
}
[VB.NET]
textBox1.Text = ''MyNameSpace.Form2''
......
Try
Dim tempAssembly As System.Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly()
’ if class is located in another DLL or EXE, use something like
’ tempAssembly = Assembly.LoadFrom(''myDLL.DLL'')
’ or
’ tempAssembly = Assembly.LoadFrom(''myEXE.exe'')
Dim frm1 As Form = CType(tempAssembly.CreateInstance(textBox1.Text), Form) ’ as Form;
frm1.Show()
Catch ex As Exception
MessageBox.Show(''Error creating: '' + ex.ToString())
End Try