For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > March 2006 > Procedure not firing









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Procedure not firing
Sheldon

2006-03-29, 6:56 pm

I have a form with a menu item that Exits the program. The code behind
mnuExit needs to be run when exiting the program. How do I get the procedure
to run when the user clicks the "X" on the top right of the form?

Thanks

Sheldon
Ken Halter

2006-03-29, 6:56 pm

"Sheldon" <Sheldon@discussions.microsoft.com> wrote in message
news:C9B7A7EE-EA0E-4E06-A3AC-E402D80989D5@microsoft.com...
>I have a form with a menu item that Exits the program. The code behind
> mnuExit needs to be run when exiting the program. How do I get the
> procedure
> to run when the user clicks the "X" on the top right of the form?
>
> Thanks
>
> Sheldon


What code are you using to get the app to shutdown. Hopefully not the End
keyword. If you're using Unload Me (which is the best way), you can just
move that code to Form_Unload.

--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm


Sheldon

2006-03-29, 6:56 pm

Never mind - I solved it.

"Sheldon" wrote:

> I have a form with a menu item that Exits the program. The code behind
> mnuExit needs to be run when exiting the program. How do I get the procedure
> to run when the user clicks the "X" on the top right of the form?
>
> Thanks
>
> Sheldon

Karl E. Peterson

2006-03-29, 6:56 pm

Sheldon wrote:
> I have a form with a menu item that Exits the program. The code
> behind mnuExit needs to be run when exiting the program. How do I
> get the procedure to run when the user clicks the "X" on the top
> right of the form?


Isolate the code in Form_Unload, and call Unload Me in mnuExit.
--
Working without a .NET?
http://classicvb.org/


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com