Results 1 to 4 of 4

Thread: App not exiting properly

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2000
    Location
    the UK
    Posts
    265

    Post

    In the mnuExit sub I have 'unload me' which seems to work fine.

    But if a user clicks on the (x) on the form, the app stops but still appears in the task list.

    Any ideas why this should happen?

    Simon

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Post

    Add the folowing code to your form's QueryUnload event. You may not need to consider all the cases.
    Code:
    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    
        Select Case UnloadMode
            Case vbFormControlMenu
                ' The user chose the Close command from the Control menu on the form
                ' Add code here to do the same things as in your mnuExit, or, preferabbly, have them perform the same Sub
    '        Case vbFormCode
    '            ' The Unload statement is invoked from code.
    '        Case vbAppWindows
    '            ' The current Microsoft Windows operating environment session
    '            ' is ending.
    '        Case vbAppTaskManager
    '            ' The Microsoft Windows Task Manager is closing the application.
    '        Case vbFormMDIForm
    '            ' An MDI child form is closing because the MDI form is closing.
    '        vbFormOwner
    '            ' A form is closing because its owner is closing.
            Case Else
                Cancel = True
        End Select
    
    End Sub
    ------------------
    Marty
    What did the fish say when it hit the concrete wall?
    > > > > > "Dam!"


    [This message has been edited by MartinLiss (edited 02-15-2000).]

  3. #3
    Addicted Member slashandburn's Avatar
    Join Date
    Aug 1999
    Location
    Marietta, Ga
    Posts
    229

    Post

    Heres An Easy Way Of doing this In the QueryExit sub on the forms make it unload all the forms example

    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

    unload form1
    unload form2

    End Sub

    If any forms arn't unloaded the program is still running

  4. #4
    Hyperactive Member
    Join Date
    Nov 1999
    Posts
    363

    Post

    I ran into your situation once before. The following has always worked for me:

    Code:
    Set Form1 = Nothing
    Set Form2 = Nothing
    ... 'all other forms
    End
    Wade

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