Hi
Call form.close when you press cancel button and form closing event you can
show the confirmation message:
Like:
Dim i As Integer
i = MsgBox("Exit?", MsgBoxStyle.YesNo + MsgBoxStyle.Question)
If i = MsgBoxResult.Yes Then
Me.DialogResult = DialogResult.Abort
Me.Dispose()
Else i = MSgBoxResult.No Then
e.Cancel = True
End If
Regards
Sooraj
Microsoft Community Star
> I have a base form with a Cancel button (btnCancel) and a simple msgbox
> routine. I would like to have a routine closing check to prevent loss of
[quoted text clipped - 13 lines]
> code and can see that the Me.dispose call is NOT being made when I click No,
> the form still closes. Any suggestions as to what I might be overlooking?
B. Chernick - 17 Oct 2004 14:55 GMT
Thanks! That worked perfectly.
(Although I'm still curious about what was causing the close in my original
example.)
> Hi
>
[quoted text clipped - 34 lines]
> > code and can see that the Me.dispose call is NOT being made when I click No,
> > the form still closes. Any suggestions as to what I might be overlooking?