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: Intermediate
Jul 31, 1998

Close Forms Uniformly

To close forms uniformly, treat the system menu's Close command and your File menu's Exit command in the same manner. In your Exit command, simply unload the form. Let the form's QueryUnload event handler see if it is safe to exit. If not, cancel the Exit by setting Cancel to True:

 Private Sub mnuFileExit_Click()
	Unload Me
End Sub
Private Sub Form_QueryUnload(Cancel _
	As Integer, UnloadMode As Integer)
	Cancel = (MsgBox("Are you sure you " & _
		"want to exit?", vbYesNo) = vbNo)
End Sub
Rod Stephens
 
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