Article View: comp.lang.basic.visual.3rdparty
Article #40Re: Terminating a program (newbie question)
From: Joel Shepherd
Date: Sat, 08 Aug 1998 00:00
Date: Sat, 08 Aug 1998 00:00
30 lines
2027 bytes
2027 bytes
As far as prompting the user to save, a good place to do this in the form's QueryUnload event. This event tells you why the form is unloading, and also gives you a way to cancel the unload. As far as terminating program goes, it's best to avoid End, since it doesn't give you, the programmer, any opportunity to clean up (close files, save data, etc.) A stand-alone VB program (not an ActiveX component) will terminate itself when: A) There are no forms loaded B) There is no executing code C) There are no events queued up for processing If you're working on a "simple" program with one or a few forms, the best way to terminate it in code is to unload each form (Unload MyForm). David Elford wrote: > > I just wanted to know about terminating a program properly. I'm aware that > using the END statement will terminate a vb program, but what about when you > click the x button in the top right corner of a form? I'd like to be able to > prompt the user with an option to save their work before exiting. I can get > a message box to appear by placing code in the form_terminate() function, > but i can't stop it from terminating. > > Any ideas would be appreciated. > > Dave
Technical Details
Message-ID:
<35CD0BD2.E6BF2B4B@ix.netcom.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<6qir1v$uq$1@nswpull.telstra.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 110e3b,c80a42a5f0abeb0e,start X-Google-Attributes: gid110e3b,public X-Google-Thread: 108062,c80a42a5f0abeb0e,start X-Google-Attributes: gid108062,public X-Google-Thread: f5f6f,c80a42a5f0abeb0e,start X-Google-Attributes: gidf5f6f,public From: Joel Shepherd <joelshep@ix.netcom.com> Subject: Re: Terminating a program (newbie question) Date: 1998/08/08 Message-ID: <35CD0BD2.E6BF2B4B@ix.netcom.com> X-Deja-AN: 379299592 Content-Transfer-Encoding: 7bit References: <6qir1v$uq$1@nswpull.telstra.net> Content-Type: text/plain; charset=us-ascii Organization: Painted Cave X-NETCOM-Date: Sat Aug 08 7:41:11 PM PDT 1998 Mime-Version: 1.0 Newsgroups: comp.lang.basic.visual.3rdparty,comp.lang.basic.visual.misc,cz.comp.lang.basic.visual