Prevent a form from closing

You can prevent a form from closing by setting event parameter "cancel" to true in "closing" the event of the form.

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 last published in April 2003

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchCloudComputing

SearchSoftwareQuality

SearchSOA

TheServerSide

SearchCloudApplications

Close