Results 1 to 5 of 5

Thread: Application not closing

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2000
    Location
    UK
    Posts
    24

    Unhappy

    I have an application in which if I close it using a button with the following code closes properly.

    Private Sub exit_Click()

    Dim sMsg As String
    Dim nButtons As Integer
    Dim nResult As Integer
    '
    sMsg = "Are you sure you want to exit?"
    nButtons = vbYesNo + vbQuestion
    nResult = MsgBox(sMsg, nButtons, APP_Title$)
    '
    If nResult = vbYes Then
    '
    End
    '
    End If
    '
    g_exit_pressed = False

    End Sub

    If I close it using the X in the corner of the window then check NT Task manager, the program is still running.

    Anyone Help????

    Thanks

    Neil

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    you could remove the X by setting the ControlBox to false
    or you could just call your sub from the query unload event and terminate event of your form.
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3
    Guest
    Maybe this will help your proplem with closing when you pressing the (X) button.
    Code:
    Private Sub Form_Unload(Cancel As Integer)
    
      Dim sMsg As String 
      Dim nButtons As Integer
      Dim nResult As Integer 
       
      sMsg = "Are you sure you want to exit?" 
      nButtons = vbYesNo + vbQuestion 
      nResult = MsgBox(sMsg, nButtons, App.Title) 
      
      If nResult = vbYes Then 
        End 
      Else
        Cancel = -1
      End If 
    
    End If

  4. #4
    Guest
    Try putting the code in Form_QueryUnload or in Form_Unload. And in the exit button:

    Code:
    Private Sub exit_Click()
    Unload Me
    End Sub
    Unload Me will trigger the Form_QueryUnload and Form_Unload events.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jan 2000
    Location
    UK
    Posts
    24
    Many Thanks All.

    Thats sorted the problem.

    Cheers

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