Results 1 to 5 of 5

Thread: Get the close event of a form [RESOLVED]

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2005
    Posts
    98

    Resolved Get the close event of a form [RESOLVED]

    Hi
    Im trying to put some code,,when a form is close,,but i try with the unload and with the desactivate method,,but it doesnt enter in these methods..but i absolutly need to put code when the window is close,,,is there a way to cath this event. My form is a part of a project thats why its not unload right now

    thanks
    Mel
    Last edited by DesyM; May 26th, 2005 at 10:02 AM.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Get the close event of a form

    The QueryUnload event fires whenever a form is closed, regardless of how it is closed.

    You can write code that will do different things depending on how it is closed.

    Is this what you mean?

  3. #3
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: Get the close event of a form

    Have a look at the QueryUnload Event it may help you

    Or, maybe the Terminate Event...

    Edit: Sorry Hack I missed your post while I was looking for that link

    Cheers,

    RyanJ
    My Blog.

    Ryan Jones.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    May 2005
    Posts
    98

    Resolved Re: Get the close event of a form

    Ok thank you, thats what i need,,,the form_query_unload

    it works well

    thanks


  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Get the close event of a form

    Quote Originally Posted by DesyM
    Ok thank you, thats what i need,,,the form_query_unload

    it works well

    thanks

    FYI. Here is some info how how you can use "how" the form unloaded.
    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.                  'or by hitting the X in the upper right hand corner
    7.                  'command from the System menu
    8.             Case vbFormCode        'UnloadMode 1
    9.                  'Unload Me has been issued from code
    10.             Case vbAppWindows      'UnloadMode 2
    11.                  'Windows itself is closing
    12.             Case vbAppTaskManager  'UnloadMode 3
    13.                  'the Task Manager is closing the app
    14.             Case vbFormMDIForm     'UnloadMod 4
    15.                  'an MDI child form is closing because
    16.                  'its parent form is closing
    17.         End Select
    18. End Sub
    PS: Edit the first post in this thread and add your checkmark there.

    Thanks.

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