Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent closing of a form

Tags:

vb6

How can i avoid closing a form if by mistake cross is clicked

like image 421
user187573 Avatar asked Oct 19 '25 05:10

user187573


1 Answers

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.

like image 66
C-Pound Guru Avatar answered Oct 22 '25 06:10

C-Pound Guru