How do I minimise an application to the system tray when I click on the minimise button?
I can minimise when the user clicks on the Close button, because I can wrap the code inside ..._Closing:
I can minimise when the user presses the escape key, because I can wrap the code inside ..._KeyDown:
What is the event that I need to wrap this code around, so that it works when I click on the minimise button?
Thank you.
Kind regards
wickyd
I can minimise when the user clicks on the Close button, because I can wrap the code inside ..._Closing:
VB.NET:
Private Sub FormMain_Closing(ByVal sender As Object, _
ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
Me.ShowInTaskbar = False
Me.Hide()
e.Cancel = True
End Sub
I can minimise when the user presses the escape key, because I can wrap the code inside ..._KeyDown:
VB.NET:
Private Sub FormMain_KeyDown(ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Keys.Escape Then
Me.Hide()
End If
End Sub
What is the event that I need to wrap this code around, so that it works when I click on the minimise button?
Thank you.
Kind regards
wickyd