Prevent a form from closing
This tip was submitted to the VS.NET Info Center by member Thomson Alexander.
Please let other users know how useful it is by rating it below. Do you have a tip or code of your own you'd like to share? Submit it here.
You can prevent a form from closing by setting event parameter "cancel" to true in "closing" the event of the form.
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) e Handles MyBase.Closing
e.Cancel = True
End Sub
This was first published in April 2003
Disclaimer:
Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.