Re: How do I disable the close window button (the X) in the form's control box?
Here is how I do it. There are constants that tell you how VB is trying to be closed.
private Sub Form_QueryUnload(Cancel as Integer, UnloadMode as Integer)
on error resume next
'//If App is Being Requested to Close From X Button Or Task Manager
'//then Don't Close. If Windows is Trying to Close It
'//then let It Close.
If (UnloadMode = vbFormControlMenu) Or (UnloadMode = vbAppTaskManager) then
'//Unload The App
Call Form_Unload(Cancel)
else
'//Cancel The Close Request And Exit Procedure
Cancel = true
Exit Sub
End If
End Sub
Kris
Software Engineer
Phoenix,AZ
Kris
Software Engineer
Phoenix, AZ USA