Don’t Let Go Without Notice

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
See also - an AI reverse image search platform

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist