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.

did you close Form2 after returning to Form1?
sounds like one of your forms are still open.

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......

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.