Results 1 to 10 of 10

Thread: Help!

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    UK
    Posts
    506

    Help!

    VB Code:
    1. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    How do i use the Cancel?

  2. #2
    Frenzied Member vbgladiator's Avatar
    Join Date
    May 2001
    Posts
    1,950
    Depending on the condition

    Cancel = True

    OR

    Cancel = False

  3. #3
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    set its value to anything but 0 and it will cancel the unload event

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    UK
    Posts
    506
    woo cheers

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    And, purely for informational purposes, here is what UnLoadMode means.
    VB Code:
    1. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    2. 'there are 5 unloadmode levels
    3.         Select Case UnloadMode
    4.             Case vbFormControlMenu 'UnloadMode 0
    5.                  'form is being unloaded via the Close
    6.                  'command from the System menu
    7.             Case vbFormCode        'UnloadMode 1
    8.                  'Unload Me has been issued from code
    9.             Case vbAppWindows      'UnloadMode 2
    10.                  'Windows itself is closing
    11.             Case vbAppTaskManager  'UnloadMode 3
    12.                  'the Task Manager is closing the app
    13.             Case vbFormMDIForm     'UnloadMod 4
    14.                  'an MDI child form is closing because
    15.                  'its parent form is closing
    16.         End Select
    17. End Sub

  6. #6
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    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.
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  7. #7
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    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.
    maybe they changed it.. what MSDN are you using... mine doesn't say that (october 2000)

  8. #8
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    April 2001
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  9. #9
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    hmmm so MS got dumber i guess huh???

  10. #10
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    It's possible they wrote multiple articles on the subject and I'm looking at an older one.
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width