I have two forms, FormA and FormB.
FormA has two buttons, one to open FormB and one to exit.
FormB has one button, to close FormB and reopen FormA.
My code goes like this:
public class FormA { private void btnOpenformB_Click(System.Object sender, System.EventArgs e) { FormB B = new FormB(); this.Hide(); B.Show(); } private void btnExit_Click(System.Object sender, System.EventArgs e) { this.Close(); } } public class FormB { private void btnReopenA_Click(System.Object sender, System.EventArgs e) { FormA A = new FormA(); this.Close(); A.Show(); } } My problem is when I click the button on FormB to reopen FormA, and when I click the exit button on FormA, it doesn't stop debugging. What should I do? Thanks!
FormA A = new FormA();you're creating a new form, when you doA.Show();you're not showing FormA that you have hidden (this.Hide();)