How do i use the Cancel? :confused:VB Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Printable View
How do i use the Cancel? :confused:VB Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Depending on the condition
Cancel = True
OR
Cancel = False
set its value to anything but 0 and it will cancel the unload event
woo cheers :D
And, purely for informational purposes, here is what UnLoadMode means.VB Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) 'there are 5 unloadmode levels Select Case UnloadMode Case vbFormControlMenu 'UnloadMode 0 'form is being unloaded via the Close 'command from the System menu Case vbFormCode 'UnloadMode 1 'Unload Me has been issued from code Case vbAppWindows 'UnloadMode 2 'Windows itself is closing Case vbAppTaskManager 'UnloadMode 3 'the Task Manager is closing the app Case vbFormMDIForm 'UnloadMod 4 'an MDI child form is closing because 'its parent form is closing End Select End Sub
Which, by the way, is contradictory to the help file for the queryunload, which states that unloadmode is always 0.
That file is wrong, Hack is right.
maybe they changed it.. what MSDN are you using... mine doesn't say that (october 2000)Quote:
Originally posted by Lord_Rat
Which, by the way, is contradictory to the help file for the queryunload, which states that unloadmode is always 0.
That file is wrong, Hack is right.
April 2001
hmmm so MS got dumber i guess huh???
It's possible they wrote multiple articles on the subject and I'm looking at an older one.