Proper way to exit program.

 

I have always just used the 'end' statement, but I don't think that is right.  What is the best way to exit after a Solid Edge macro is done?

 

Posted by: Bob Reinkemeyer
Post date: 11/19/2007 4:54:20 AM

3 REPLIES

RE: Proper way to exit program.

 

Bob,

As you suspected, calling End is the worst way to end any program.  Depending on what type of program you're dealing with, ending the application will vary.  If you have a Windows forms application, you simply want to unload all forms with the main form being the last to unload when you're done.  If you have a console application, you can simply let the program finish on it's own since it typically does not have a Windows message loop.

http://msdn2.microsoft.com/en-us/library/0wt87xba(VS.80).aspx

http://www.mvps.org/vbvision/visual_basic_tips.htm

 

Posted by: Jason Newell
Post date: 11/19/2007 11:41:43 AM

RE: Proper way to exit program.

 

Its a windows forms app. to automate our sprocket modeling.  All the sprocket information is entered in a form, then sent to solid edge to make the part.  The project also does some database stuff, with access as a backend.  Its not too memory intensive, but i want to make sure i release everything when i exit.  Thanks for the help!

 

Posted by: Bob Reinkemeyer
Post date: 11/20/2007 12:54:34 AM

RE: Proper way to exit program.

 

Hi,

if your app is an .Net application, there is an tool  - Garbage Collector. It serve us an automatic memory management (as it seems - GC works..). So - in these way you don't have to worry about removing any object manualy.

But - if there're any open connections, open files etc - better is to close it manualy in program code, before application lifetime is up.

 

 

Posted by: Piotr Jedrkowiak
Post date: 1/4/2008 2:44:03 AM