I am doing mini project in VB.net. Actually my project contains form1 and form2. I have opened form2 from form1 using "form2.show()" method. While closing form2, my application still remains in debugging mode. I thought my form1 has not yet been closed and used me.close() , to close form1 while opening form2. By doing this i am not able to run my application. please suggest me a solution.

go to your Project -> Properties -> Application
set Shutdown Mode to "When last form closes"

on that way you can close Form1 after Form2.show and the application runs until you close Form2 too

now i if i go back to my form1 and i close form1, it remains in debug mode. so can you can suggest a solution so that if i close any form, i can get out of debugging state.

I guess you could just kill the application when any form shuts down. This sounds like a bad idea but its what you asked:

Private Sub FormDragDrop_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
		Application.Exit()
	End Sub

I guess you could just kill the application when any form shuts down. This sounds like a bad idea but its what you asked:

Private Sub FormDragDrop_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
		Application.Exit()
	End Sub

That's working and thanks a lot......

This question has already been answered. Start a new discussion instead.