Form_Unload help

RuffRyder
04-02-2003, 04:26 AM
hi,

if have a little problem on my Form_unload sub. When I close my form, a vbOkCancel messagebox appears. But when I press cancel, the form closes anyway. How can I solve this that when I click the cancel button, the form doesn't close.

Thanks
RuffRyder

Machaira
04-02-2003, 06:31 AM
Try something like:

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If MsgBox("Do you want to cancel unloading?", vbYesNo) = vbYes Then Cancel = True
End Sub

Depending on what the message in the MsgBox is, a Cancel button might not be meaningful. If it is, just replace vbYes with vbCancel and vbYesNo with vbOKCancel.

RuffRyder
04-02-2003, 06:45 AM
ok, thanks, i'll let you know if it works

Machaira
04-02-2003, 06:50 AM
No need, I know it works. :) ;)

RuffRyder
04-04-2003, 02:06 AM
thanx man, tried it & it works

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum