by Flemming Sudsgaard (1 Submission)
Category: Miscellaneous
Compatability: Visual Basic 5.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating:
(5 Votes)
I have seen alot of code disabling the "X" on the form to prevent uses closing the form, i.e. in the middle of data processing, this is a little "work around" i have been using...no magic..(o: or heavy API calls
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If UnloadMode <> vbFormCode Then
MsgBox "You gotta use the button"
Cancel = 1
Else
Unload Form1
Set Form1 = Nothing
End If
End Sub