Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Aug 6, 1997

Don't Let Go Without Notice

Users may unexpectedly quit your application by clicking the close menu in the control box or by clicking the close button under Windows 95. Add a procedure to the QueryUnload event on the main form of your application to prevent the problem.

If the UnLoad attempt to your application's form is not issued explicitly by your code, the UnLoadMode parameter is not equal to 1 (VB4 Constant - vbFormCode). You can cancel this attempt by setting the Cancel parameter to True. Visual Basic Help explains the details of QueryUnload event:

 
Private Sub Form_QueryUnload(Cancel _
        As Integer, UnLoadMode As Integer)

'check if the unload attempt is issued 
'explicitly by code
If UnLoadMode <> 1 Then
        Cancel = True
        'prompt message box for 
        'confirmation, and exit or 
        'continue according to user input
End If

End Sub

Jiyang Keven
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date