vb program closing help

kpsg25690's Avatar, Join Date: Aug 2009
Go4Expert Member
Hello everyone,i am new to visual basic but have to make an application using it for a project.
I am familiar with c/c++ and visual basic seems easy enough,besides there is a lot of help online.
I am using visual basic 2010.
I have made half of the application and am facing a problem.
I have three forms so far in my project with possibly more to come but the problem is that when i run the exe file and close it after i'm done , i can still see it in the task manager and when i run it in the software itself and close it, i have to stop debugging manually everytime!
shouldn't that be automatically done each time i close??

please help i even tried putting a close button with me.close() command but it doesn't seem to help!
peterpaulrubens2011's Avatar, Join Date: Jun 2011
Newbie Member
Application.Exit() and Environment.Exit() all could implement this. There are also some differences between them. For more information, you could read this link:
kpsg25690's Avatar, Join Date: Aug 2009
Go4Expert Member
thanks peterpaulrubens2011
i used Application.Exit() in the close buttons and it works great now but i still have the same problem if i use the close button of the window instead of the one included on the form itself.
can i use the application.exit() when the close button on the window is clicked or is there any other way i can accomplish this?

Thanks in advance..
ManzZup's Avatar, Join Date: May 2009
Skilled contributor
you can put your code into
form1_formclosing event

but this cannot be possible as i didnt get this kind of error so far
i think what you are doing is something like calling a second form from the first form hiding the first and then closing the second form
but in vb you are needed to close the Main form to stop executing the program
in the form closing event of the other programs
put something like form1.close()
kpsg25690's Avatar, Join Date: Aug 2009
Go4Expert Member
yes ,i am calling form 2 from form 1 and hiding form 1.i'll try what you suggested and post the result..