Closing a form and then call another one.

Posted by elvispt on Stack Overflow See other posts from Stack Overflow or by elvispt
Published on 2010-05-01T18:25:32Z Indexed on 2010/05/01 18:27 UTC
Read the original article Hit count: 192

Filed under:
|
|

Hi.

I want to close the current form I'm on (MainForm) and then opening a second one (Form).

I've tried:

private void buttonStartQuiz_Click(object sender, EventArgs e)
        {
            this.Close();

            Form2 form2 = new Form2();
            form2.ShowDialog();
        }

Or adding the this.Close(); after the ShowDialog also doesn't work.

Any hints?

Thank you.

© Stack Overflow or respective owner

Related posts about c#

Related posts about forms