tags:

views:

64

answers:

1

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
+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
Thanks MarkJ. Funny how page 1 of google search for vb6 queryunload event doesn't list the msdn page...
C-Pound Guru