How can i avoid closing a form if by mistake cross is clicked
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, see the MSDN VB6 Language Reference or check out this article.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With