2
Answers

Project wont stop debugging.

Awais Tanveer

Awais Tanveer

16y
6.9k
1
Hi!
I am a novice.I have 2 Forms form1 and form2. On form1 i have placed a 2 buttons. Button1 takes the user to form2 using form2.show(); method and Button2 makes to user to exit from application which has a code of this.close().  It works fine and when user clicks that button2, it exits from the application and stops debugging fine.

Problem lies when user go to Form2 (which has a go back button that takes user back to form1) and comes back to Form1 to exit from application. now after coming back to Form1 and pressing the exit button, Form1 gets closed Ok but project wont return from debugging mode so i have stop debugging manually every time.

Though I am Disposing the Form2 object to release all the resouces before coming back to Form1 but still doesnt helps. Any thoughts?

here is the code on the Form2.

private void lable_back_MouseClick(object sender, MouseEventArgs e)
        {
            Form1 frm = new Form1();

            frm.Region = this.Region;
            this.Close();
            this.Dispose();
            frm.Show();
        }

Any help would be appiciated.
Answers (2)