Advertisement

VB's Form_Unload()

Started by November 18, 2000 11:30 PM
0 comments, last by vbisme 24 years, 1 month ago
Private Sub Form_Unload(Cancel As Integer) End Sub In this, when the user click on the "X" or Close button it will load. There''s a Cancel thing that I don''t know how to use. How do I ask if the user really want to close and the act on that?

Private Sub Form_Unload(Cancel As Integer)

dim iRet As Integer



iRet = MsgBox("Do you really want to quit?",vbYesNo)

If iRet = vbNo then Cancel = 1



End Sub





Basically, if you want to cancel the unloading of the form, set Cancel to any non-zero value. Hope this helps!
RIP GameDev.net: launched 2 unusably-broken forum engines in as many years, and now has ceased operating as a forum at all, happy to remain naught but an advertising platform with an attached social media presense, headed by a staff who by their own admission have no idea what their userbase wants or expects.Here's to the good times; shame they exist in the past.

This topic is closed to new replies.

Advertisement