Not sure if there is a way. You could add a property to your form say DIM bClose as Boolean = False.
Then instead of calling me.close, call a new method called Me.zclose. Its worth having a custom close method to call through code, to perform any other cleanup code too.
private sub zclose
Me.bClose=True
Me.close
end sub
Hey Kris11. Thanks for the reply. And I like SqueakinSweep's way too. I started doing SqueakinSweep's way but yours is much cleaner. (no vars to mess with).
Protected Overloads Overrides Sub WndProc(ByRef m As Message)
If m.Msg=WM_SYSCOMMAND AndAlso m.WParam.ToInt32=SC_CLOSE Then
MessageBox.Show("X clicked" m.Msg=0 <--- Stop closing
End If
MyBase.WndProc(m)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.