Question

I've used this code to make and show a form in a MdiWindow:

        if (currentForm != null) {
            currentForm.Dispose();
        }
        currentForm = new ManageCompanies();
        currentForm.MdiParent = this;
        currentForm.Show();
        currentForm.WindowState = FormWindowState.Maximized;

I used this code to show about 20 different forms...

I want to write a such function:

private void ShowForm(formClassName) {

            if (currentForm != null) {
                currentForm.Dispose();
            }
            currentForm = new formClassName();
            currentForm.MdiParent = this;
            currentForm.Show();
            currentForm.WindowState = FormWindowState.Maximized;
}

Do I have to send formClassName as a string or something else; and how to include it in the code... I want the final code...

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top