|
-
Oct 11th, 2005, 04:13 AM
#1
Thread Starter
Junior Member
[RESOLVED] I received help on a VB 6.0? but I'm still confused please explain.
So on this thread
http://www.vbforums.com/showthread.php?t=364968
Two fine posters showed me how to do a (Are You Sure Y/N?) box. Out of curiousity the one that was to be posted in my cmdExit bar has to be clicked on "Yes" twice in order for it to exit. Is that normal or have I done something wrong? Here is the code I was given.
VB Code:
Private Sub cmdExit_Click()
If MsgBox("Are you sure you want to quit?", vbExclamation + vbYesNo) = vbNo Then
Exit Sub
End If
Unload Me
End Sub
The Unload Me comment, I've tried to name my form, but that just causes errors, whereas the unload me works, only "yes" has to be clicked twice.
Again many thanks from the gurus in advance.
-
Oct 11th, 2005, 04:39 AM
#2
Addicted Member
Re: I received help on a VB 6.0? but I'm still confused please explain.
Did you include the same code under
VB Code:
Private Sub Form_Unload(Cancel As Integer)
End sub
if you did thats why its being fired twice and the messagebox appears twice
-
Oct 11th, 2005, 04:48 AM
#3
Re: I received help on a VB 6.0? but I'm still confused please explain.
Just use the ff...
VB Code:
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
If MsgBox("Are you sure you want to exit? ", vbQuestion + vbYesNo, "Confirm Exit") = vbNo Then
Cancel = 1
End If
End Sub
-
Oct 11th, 2005, 04:56 AM
#4
Thread Starter
Junior Member
Re: I received help on a VB 6.0? but I'm still confused please explain.
I can't believe that I didn't pick up on that. I am even having a hard time picking up the simple procedures.
Thank you for pointing out the redundancy in my programming. I'll mark this topic resolved.
-
Oct 11th, 2005, 04:57 AM
#5
Re: [RESOLVED] I received help on a VB 6.0? but I'm still confused please explain.
Don't worry, you are not alone...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|