Abort the closing proceedure

BigSi

Newcomer
Joined
Feb 6, 2003
Messages
22
Is there a way to prevent a form from closing when the user clicks on the close button on the top right of the form. I plan to bring up a message box asking if they are sure they want to do this - I cant seem to find how to do it in VB.NET :(

Thanks.
Si
 
Excellent - Thanks for your quick reply :)
heres the code that I ended up using if anyone is intrested


Visual Basic:
Private Sub Account_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
        Dim CloseAnswer As Integer
        CloseAnswer = MsgBox("Are you sure you want to close this form?", MsgBoxStyle.YesNo)
        If CloseAnswer = 6 Then
            'the user wants to continue quitting
            'Me.Close()
        Else
            'the user has changed his/hers mind
            e.Cancel = True
        End If
    End Sub
 
Back
Top