|
-
Dec 20th, 2003, 09:52 AM
#1
Thread Starter
Junior Member
Trapping the close button
hi,
can we trap the clicking of close button of a vb form. if so can even trap the alt + f4 command.
my main prob is i want to display the msgbox before closing the project. so that by clicking the ok button it has to close if they click cancel nothing should happen.
i tried to write it in unload function but i didnt find any solution.
plz can anybosy helps me plzzzz.
-
Dec 20th, 2003, 10:36 AM
#2
Addicted Member
Try looking into the query unload event. This has a parameter called UNLOADMODE. This should be what you are looking for.
Best Of Luck
-
Dec 20th, 2003, 11:59 AM
#3
Lively Member
Try this ... I believe it works for both
VB Code:
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If UnloadMode = vbFormControlMenu Then
MsgBox "You cannot use that button", vbInformation + vbOKOnly, "Not allowed"
Cancel = True
End If
End Sub
-
Dec 20th, 2003, 12:29 PM
#4
Supreme User
Re: Trapping the close button
Originally posted by vbinfant
i tried to write it in unload function but i didnt find any solution.
plz can anybosy helps me plzzzz.
Unload isnt a function
-
Dec 20th, 2003, 12:33 PM
#5
The picture isn't missing
Re: Re: Trapping the close button
Originally posted by Madboy
Unload isnt a function
that's very unecessary.... don't do that
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Dec 20th, 2003, 12:38 PM
#6
Supreme User
Re: Re: Re: Trapping the close button
Originally posted by BuggyProgrammer
that's very unecessary.... don't do that
Sorry, but neither was your reply
Just letting him know, it might confuse people later on
-
Dec 20th, 2003, 12:38 PM
#7
The picture isn't missing
Re: Re: Re: Re: Trapping the close button
Remember, if someone's post was not helpful, you can always rate their post negatively  .
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
|