Opening form based on user input form name
I have a startup screen that shows a list of forms in a Data Grid View. The user double clicks on one of the names and I want to open the form with that name.
To open a form, I have to do this:
FormName frm = new FormName();
frm.Show();
But if the name of the form is decided by user input, how do I open that form?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

jingeRank #2,527 · 554 reputationPosted Dec 7, 2009, 3:01 PM EST
private void button1_Click(object sender, EventArgs e) { ObjectHandle o = Activator.CreateInstance(null, "CreateFormBasedOnUserInput.Form2"); if (o.Unwrap() is Form) { (o.Unwrap() as Form).ShowDialog(); } }