Prevent a Form From Closing in VB.NET
Category:C#, VB.NET, ASP.NET
Version Compatibility: Visual Basic.NET
The Closing event occurs when a Form is being closed. If this event is cancelled, the Form remains open. To cancel the closure of a Form, set the Cancel property of the CancelEventArgs passed to event handler to True, as illustrated by this code.
Instructions: Copy the declarations and code below and paste directly into your VB project.