How to hide VB.Net form instead of closing it
By Allen Stoner
Sometimes in a program you may want a form to appear like it closes but still be there for you to access it programmatically. If you want the user to be able to click the close button and have it appear like it closes but actually hide it you can use the FormClosing event. There is a little extra coding that needs done to be sure the form does close if the entire program is closing or windows is shutting down.
Private Sub frmNotary_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
If e.CloseReason <> CloseReason.FormOwnerClosing Then
e.Cancel = True
If you want to disable the 'X' for the Window close in a VB.NET you need to add some special code to the form. It is not quite as easy as using a property like the minimize and maximize buttons. Add the following code as a property to your form and it will disable the close button in the Windows bar.
How to hide VB.Net form instead of closing it (677 Views)