Go4Expert (http://www.go4expert.com/)
-   Visual Basic ( VB ) (http://www.go4expert.com/forums/visual-basic/)
-   -   vb program closing help (http://www.go4expert.com/forums/vb-program-closing-help-t26108/)

kpsg25690 21Jun2011 17:07

vb program closing help
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 22Jun2011 00:38

Re: vb program closing help
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 22Jun2011 08:00

Re: vb program closing help
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 12Jul2011 11:50

Re: vb program closing help
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 12Jul2011 12:31

Re: vb program closing help
yes ,i am calling form 2 from form 1 and hiding form 1.i'll try what you suggested and post the result..

All times are GMT +5.5. The time now is 07:30.