🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.basic.visual.3rdparty
3 messages
3 total messages Started by David Elford Sun, 09 Aug 1998 00:00
Terminating a program (newbie question)
#41
Author: David Elford
Date: Sun, 09 Aug 1998 00:00
10 lines
1127 bytes
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
Re: Terminating a program (newbie question)
#40
Author: Joel Shepherd
Date: Sat, 08 Aug 1998 00:00
30 lines
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
Re: Terminating a program (newbie question)
#42
Author: William Sayers
Date: Tue, 11 Aug 1998 00:00
21 lines
1520 bytes
Try This, Instead of using the Terminate function use the query_unload()
function and whenever anyone tries to terminate it should pop up, Then you
can treminate or not depending on the return value of the Message Box.
wsayers@softhome.net

David Elford wrote in message <6qir1v$uq$1@nswpull.telstra.net>...
>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
>
>
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads