How do I terminate my running application?

Hi ya'll,
   I compiled my program and then run the EXE, and when I quit the program it is gone.  But the thing is it is still running in the background (I checked for it using task manager).  On the quit button I used Unload Me.  How can I "kill" the program completely so it will release the database it connected to.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Try putting this code in the Unload event of your main form..

  For Each Form In Forms
    If Not (Form Is Me) Then
      Unload Form
    End If
  Unload Me

you should close all your database objects and set them to nothing.
there is probebly more but having no code of yours, what can one say ?
Not a very graceful solution, but have you tried END.  I agree, you should unload all your forms and release all your database variables.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

END should work. If that does not, try ExitProcess API call with the exit code 0.

If that does not work also, that means somewhere in your application (or in the calld extrenal function(s)) there are other threads running. This will make your VB app to go but the process will not be terminated until all the threads exits. In this case try using TerminateProcess API.

Hope this helps you...
stephenhoangAuthor Commented:
Thanks a bunch to all of you.
  I gave barnacky the points because barnacky is the first one to suggest the magic word END and it worked for me :)
The reason noone suggested END is that it's NOT a command that is to be used whenever the program doesn't correctly shut down, since it does not clear memory used by the program..
Oh sorry, misread it somewhat, thought manojamin's answer was accepted as the answer, but now I c that barnacky mentioned the right way to do it when he told you to use the end statement.
i admit that sometimes i make the sin of using the END too, but that is only on my "QUICK AND DIRTY" experiments.
giving what seems to be a beginer this solution will make him a lousy programmer, who'll never know how to terminate processes since he have the MAGIC WORD as he already said...
if it was really magic - fine. that's RAD, but it is not. i'd like to see this word cleans a rowbust DCOM solution with hundreds of objects around.
You can try using 'END' but if you have a number of different forms open and they are not in the Taskbar you may have the same problem.
As I stated earlier, END is not a graceful solution.  Unloading all the forms with an IsLoaded function, terminating any processes, and releasing all (database) variables is a much better solution.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.