Free Web Hosting Provider - Web Hosting - E-commerce - High Speed Internet - Free Web Page
Search the Web

vbProgramming | Tutorials | Miscellaneous | "Do you really want to quit?"
    vbProgramming 
Tutorials |
Miscellaneous | "Do you really want to quit?"
 
     

vbProgramming Home :: vbProgramming Forums :: Tutorials :: Contact :: Links 

 

 

Short and sweet "Do you really want to quit" tutorial. You'll basically make an app which doesn't let you quit unless you say yes, this will apply even if you hit alt+f4

Intro
This tutorial will be really short.

Go to form1_closing and type in the following code:

Dim result As MsgBoxResult
result = MessageBox.Show("Do you really want to quit?", "Quit?", MessageBoxButtons.YesNo, MessageBoxIcon.Question)

If result = MsgBoxResult.No Then
   e.Cancel = True
End If

Most of it is pretty self explanatory.  Run it and you'll see that it won't let you quit unless you push Yes. The only way to quit (without going through the messagebox) is to control alt delete out of the program.

That's pretty much it for this tutorial (I told you it would be short).

There is no source code for this tutorial (everything is right above!)