Go Back  Xtreme Visual Basic Talk > Visual Basic .NET (2002/2003/2005/2008, including Express editions) > .NET General > alert upon closing


Reply
 
Thread Tools Display Modes
  #1  
Old 01-20-2004, 06:10 PM
SpiN9823's Avatar
SpiN9823 SpiN9823 is offline
Centurion
 
Join Date: Jan 2004
Location: New Jersey
Posts: 126
Default alert upon closing


how do i make an alert when you close the program that says "Are you sure you want to quit?"
Reply With Quote
  #2  
Old 01-20-2004, 10:39 PM
VBJoe's Avatar
VBJoe VBJoe is offline
Village VB Idiot

* Expert *
 
Join Date: Jan 2003
Location: Idaho
Posts: 1,850
Default

Use the Closing event:
Code:
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing If Microsoft.VisualBasic.MsgBox("Quit now?", MsgBoxStyle.YesNo, "Confirm Exit") = MsgBoxResult.No Then e.Cancel = True End Sub
Reply With Quote
  #3  
Old 01-20-2004, 10:55 PM
OnErr0r's Avatar
OnErr0r OnErr0r is offline
Obsessive OPtimizer

Administrator
* Guru *
 
Join Date: Jun 2002
Location: Debug Window
Posts: 13,685
Default

You can also use MessageBox.Show(), which is not part of Legacy Visual Basic backwards compatibility.
Reply With Quote
  #4  
Old 01-20-2004, 11:02 PM
VBJoe's Avatar
VBJoe VBJoe is offline
Village VB Idiot

* Expert *
 
Join Date: Jan 2003
Location: Idaho
Posts: 1,850
Default

Very cool.

I notice the MessageBox class' Show method has been overloaded 12 times. Man I love .NET...
Reply With Quote
  #5  
Old 01-20-2004, 11:11 PM
OnErr0r's Avatar
OnErr0r OnErr0r is offline
Obsessive OPtimizer

Administrator
* Guru *
 
Join Date: Jun 2002
Location: Debug Window
Posts: 13,685
Default

Me Too!
Reply With Quote
  #6  
Old 01-21-2004, 07:04 PM
SpiN9823's Avatar
SpiN9823 SpiN9823 is offline
Centurion
 
Join Date: Jan 2004
Location: New Jersey
Posts: 126
Default

thx VBJoe
__________________
SpiN
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Closing access application - clicking X on top right rajanikanth_r Word, PowerPoint, Outlook, and Other Office Products 0 12-23-2003 12:13 AM
How do I stop Word closing? Tangled_Kid Word, PowerPoint, Outlook, and Other Office Products 1 06-20-2003 06:52 AM
Closing forms without closing project stevenafc2 General 4 04-02-2003 04:33 AM
Outlook Closing blankenm Word, PowerPoint, Outlook, and Other Office Products 2 12-03-2002 01:34 PM
Message Box Alert anu1c General 4 10-29-2001 04:53 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->