ShaneBrennan
Programmer
I'm trying to stop a form from unloading, except via code. I found the following code from VBExplorer.com and it works fine, except it still allows Task Manager to close down the application:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
On Error Resume Next
'UnloadMode possibilities:
'0 The user has chosen the Close command from the Control-menu box on the form.
'1 The Unload method has been invoked from code.
'2 The current Windows-environment session is ending.
'3 The Microsoft Windows Task Manager is closing the application.
'4 An MDI child form is closing because the MDI form is closing.
If UnloadMode <> 1 Then
Cancel = True
' free to continue with program
End If
End Sub
Task Manager takes about 5 seconds then returns it's infamous message "The application is not responding, shall I give it another 5 seconds or shall I close it down now!"
Has anyone got any idea how to prevent this, and keep the program runing?
Thanks for any help.
Shane Brennan
Shane Brennan
Shane.Brennan@tcat.ac.uk