|
-
Aug 14th, 2000, 05:24 AM
#1
Thread Starter
Junior Member
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
-
Aug 14th, 2000, 05:32 AM
#2
_______
<?>
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
-
Aug 14th, 2000, 05:38 AM
#3
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
-
Aug 14th, 2000, 05:38 AM
#4
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.
-
Aug 14th, 2000, 05:45 AM
#5
Thread Starter
Junior Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|