BigSi Posted February 19, 2003 Posted February 19, 2003 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 Quote
Heiko Posted February 19, 2003 Posted February 19, 2003 http://www.xtremedotnettalk.com/showthread.php?s=&threadid=69575&highlight=form+closing Quote .nerd
BigSi Posted February 19, 2003 Author Posted February 19, 2003 Excellent - Thanks for your quick reply :) heres the code that I ended up using if anyone is intrested 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.