Getting form to minimize when exit button is clicked

lickuid

Active member
Joined
Nov 6, 2006
Messages
37
Programming Experience
Beginner
Does anyone know how to override a form closing? In other words, when I click the red exit button, I want the form to hide() instead of actually closing... Any help will be greatly appreciated.
 

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
in the form's Closing event set e.Cancel to True then right after that Me.Hide()

VB.NET:
Private Sub Form_Closing (...) Handles MyBase.Closing
  e.Cancel = True
  Me.Hide()
End Sub
 
Top Bottom