martin2k

Google
 
Web www.martin2k.co.uk

msgbox


Home Read and add posts to the Visual Basic 6.0 Forums Download some of my programs and OCXs Read the Tips here The old style forum is still available here Contact

Back


From: Pam E-mail: AandPParker@aol.com 1

Date: Wednesday, April 18, 2001 at 23:30:42

Subject: msgbox

Comments:

I am a student new to VB6.0 and would very much appreciate help with my college assignment:

My form has an 'EXIT' command button. The onclick property of this button displays the following msgbox:

"Do you really wish to quit this program? OK, Cancel

If the user clicks on OK - I want the program to close but if they select 'CANCEL' I want the msgbox to close and the focus back with the active form.

Can you suggest what code I might use? 

Many thanx!

From: Martin Allen E-mail: <No e-mail> 2

Date: Friday, April 20, 2001 at 20:50:58

Subject: RE: msgbox

Comments:

The code you need is this (substitute Command1 with the name of your exitbutton):

Private Sub Command1_Click()
Select Case MsgBox("Do you really wish to quit this program?", vbOKCancel + vbQuestion, "Confirmation")
Case vbOK
Unload Me
End Select
End Sub

This forum is no longer taking new messages or replies since 01 November 2002.  The above material is for reference purposes only.

The new Visual Basic 6.0 forum can be found here.


Martin Allen 1999 - 2003.  Last updated Monday 12 May 2003 07:58:07 PM +0100.