Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing a program 2

Status
Not open for further replies.

jjhobs

Instructor
Sep 18, 2003
27
GB
Can anyone advise the best way to close down a project. I have noticed that in some instances projects are still running when I think they have been closed. I have used:

Close()
Dispose()

for programs with 1 form. For programs with more than one form I have used Application.exit. On some occasions I have also noticed that the Stop Debugging button doesn't actually stop the program running.

Is there one way that always works? Thanks.
 
use End. (This can only be used for windows applications, not DLLs)

Dispose will only kill the form.

I hope this helps.

Ron Repp

If gray hair is a sign of wisdom, then I'm a genius.
 
Exit the app:
Applcation.Exit()

Exit the thread: (if only one, then the app will terminate)
Applcation.ExitThread()


Close the object: (can be a form, or connection)
xxx.Close()

The .Dispose(True) terminates an object. If the ovject is the StartUp Form, then by calling that method with true, will terminate the app.

The .Dispose(false) does the same thing, but the app wont terminate even if the object is the startup form
 
Thanks for the insight.

A star for you...

Ron Repp

If gray hair is a sign of wisdom, then I'm a genius.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top