-
Jan 29th, 2000, 06:52 AM
#1
Thread Starter
Lively Member
Let me divide my problem into 2 parts
If i click on the main form close button - Iam asking the user do u really wish to exit
1. if the user says i need to close all open forms that means send windows message to close the forms - may be if data entry is going on in those forms i may do something but i need the message to go to all open forms.
2.Now if the user says no i need to stay in the application but the main forms close executes form unload and my whole app. closes
-
Jan 29th, 2000, 06:59 AM
#2
Put your code in the QueryUnload Event of the Form, then if the user doesn't really want to Quit, you can set the Cancel Parameter to any Non-Zero Value to Cancel the Unload Process, ie.
Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Dim oFRM As Form
If MsgBox("Do you really want to Exit?", vbQuestion + vbYesNoCancel, "Exit") = vbYes Then
For Each oFRM In Forms
Unload oFRM
Set oFRM = Nothing
Next
Else
Cancel = True
End If
End Sub
------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
ajyoung@pressenter.com
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
|