How can i avoid closing a form if by mistake cross is clicked
+7
A:
Handle this in the Form's QueryUnload event. There's an UnloadMode parameter and a Cancel Parameter:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If UnloadMode = vbFormControlMenu Then Cancel = True
End Sub
For more info on the QueryUnload event, check out this article.
C-Pound Guru
2009-10-10 14:31:36
+1. An alternative source of info about QueryUnload is the VB6 language reference: on MSDN here http://msdn.microsoft.com/en-us/library/aa445536(VS.60).aspx
MarkJ
2009-10-10 20:19:18
Thanks MarkJ. Funny how page 1 of google search for vb6 queryunload event doesn't list the msdn page...
C-Pound Guru
2009-10-10 21:17:04