So let's say I clicked a button and it's supposed to open a new form and close the current form.
private void button1_Click(object sender, EventArgs e)
{
this.Close();
Form2 AFormInstance = new Form2();
AFormInstance.Show();
}
I tried this.Close()
but what ended up happening was both forms closed. How do I open Form2
and close Form1
?