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 form2.ShowDialog()
also doesn't work.
Any hints?
EDIT: Might as well add that by adding this.Close()
after form2.ShowDialog()
it close only when I close the new form.
If I choose form2.Show()
instead it immediately closes both of the forms.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…