Don’t Let Go Without Notice

Users may unexpectedly quit your application by clicking the closemenu in the control box or by clicking the close button underWindows 95. Add a procedure to the QueryUnload event on the mainform of your application to prevent the problem.

If the UnLoad attempt to your application’s form is not issuedexplicitly by your code, the UnLoadMode parameter is not equalto 1 (VB4 Constant – vbFormCode). You can cancel this attemptby setting the Cancel parameter to True. Visual Basic Help explainsthe details of QueryUnload event:

 Private Sub Form_QueryUnload(Cancel _        As Integer, UnLoadMode As Integer)'check if the unload attempt is issued 'explicitly by codeIf UnLoadMode <> 1 Then        Cancel = True        'prompt message box for         'confirmation, and exit or         'continue according to user inputEnd IfEnd Sub
Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: