Help: Control Box doesn't work right. 
Author Message
 Help: Control Box doesn't work right.

I have VB Pro 4.  I am writing 32 bit code for Win95.  If I create a
button w/ "end" for the code, my program exits fine.  However, when I
use the "x" on the control box my program quits but the "close program
dialog box" that you get w/ Ctrl-Alt-Del shows my program still being
active?????????????????  Help me make this control box work.

TIA,

_____________________________
                Shawn Smith
                    UNT
Official:
http://www.*-*-*.com/ ~ss0051
Unofficial:
http://www.*-*-*.com/



Mon, 24 Jul 2000 03:00:00 GMT  
 Help: Control Box doesn't work right.

Put a set form = nothing in the form_Unload event

Richard

Quote:

>I have VB Pro 4.  I am writing 32 bit code for Win95.  If I create a
>button w/ "end" for the code, my program exits fine.  However, when I
>use the "x" on the control box my program quits but the "close program
>dialog box" that you get w/ Ctrl-Alt-Del shows my program still being
>active?????????????????  Help me make this control box work.

>TIA,

>_____________________________
>                Shawn Smith
>                    UNT
>Official:
>http://people.unt.edu/~ss0051
>Unofficial:
>http://www.cs.unt.edu/home/ssmith



Mon, 24 Jul 2000 03:00:00 GMT  
 Help: Control Box doesn't work right.



Quote:
> I have VB Pro 4.  I am writing 32 bit code for Win95.  If I create a
> button w/ "end" for the code, my program exits fine.  However, when I
> use the "x" on the control box my program quits but the "close program
> dialog box" that you get w/ Ctrl-Alt-Del shows my program still being
> active?????????????????  Help me make this control box work.

Hi Shawn,

This seems to be a common misconception. It is documented in the KB
but not in the VB Help file.

Closing (ie. unloading) a window doesn't end the app, which still has
all the module-level code in memory, and perhaps other hidden (or
merely unloaded) forms and other code modules.

'Unload' (or closing using control box) merely unloads the graphical
interface of the form. Compare 'Load', which merely loads the
graphical interface. The code for each form is moved into memory when
the Initialise event fires, and destroyed when the Terminate event fires.

You can initialise any module by referencing it or instantiating it,
and can terminate it with 'Set FORM/CLASS = Nothing'.

This ties in with how a class works: a class is just the 'code' part
of a form, without the graphical interface. It still has Initialise
and Terminate events, but no Load or Unload.

However, the End statement does all this for you if you want to end
the whole app. Put 'End' in the Unload event of the app's main form.

Steve.



Mon, 24 Jul 2000 03:00:00 GMT  
 Help: Control Box doesn't work right.

On Thu, 5 Feb 1998 17:36:45 +1030, "Richard French"

Quote:

>Put a set form = nothing in the form_Unload event

>Richard

Thanks Richard.

_____________________________
                Shawn Smith
                    UNT
Official:
http://people.unt.edu/~ss0051
Unofficial:
http://www.cs.unt.edu/home/ssmith



Mon, 24 Jul 2000 03:00:00 GMT  
 Help: Control Box doesn't work right.

Shawn

You should NEVER use the End statement.

If the basis of your app is a form, the OK button should issue 'Unload
Me' and all your tidying up code done in the Form_Unload event (or, if
there is user-cancellable stuff, such as file saving, to be done, in the
Form_QueryUnload event). That way, the X will get you to the same point.
The run will then end when you exit the Form_Unload event.

If you were running from a Sub Main, then exiting that will end your
run.

Regards
{*filter*}

Quote:

>I have VB Pro 4.  I am writing 32 bit code for Win95.  If I create a
>button w/ "end" for the code, my program exits fine.  However, when I
>use the "x" on the control box my program quits but the "close program
>dialog box" that you get w/ Ctrl-Alt-Del shows my program still being
>active?????????????????  Help me make this control box work.

>TIA,

>_____________________________
>                Shawn Smith
>                    UNT
>Official:
> http://www.*-*-*.com/ ~ss0051
>Unofficial:
> http://www.*-*-*.com/



Mon, 24 Jul 2000 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. List Box Lost Control Doesn't Work

2. Loop statement doesn't work right

3. right alignment in richtextbox doesn't work

4. Form menu editor doesn't work right??

5. Q: Why auto-redraw doesn't work right in Windows-NT

6. AddNew method doesn't work right!!

7. Right$ doesn't work!

8. IE3 doesn't work after working with webbrowser control

9. Help: MAPI control doesn't work - why?

10. Help!: VB control (OCX) doesn't work in Word for Windows

11. fRefreshLinks Doesn't work if path doesn't exist

12. Bypass SaveAs .PDF dialog box doesn't work

 

 
Powered by phpBB® Forum Software