First of all you will need to create a CheckBox and rename it to an appropriate name. I've renamed mine to cbMinimize. It doesn't necessarily need to be a CheckBox but for this example I have done. I have previously used this code as a button in a MenuStrip.
Second thing to do will be to insert a NotifyIcon into your program. This is where the code that will minimize your program will go.
#Region "Notification Minimalize code" 'When you double click the notify icon in the system tray(notification area) the form automatically shows 'and the notify icon disapears. Private Sub NotifyIcon1_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseDoubleClick If cbMinimize.Checked = True Then Me.Show() Me.StartPosition = FormStartPosition.CenterScreen Me.WindowState = FormWindowState.Normal NotifyIcon1.Visible = False End If End Sub 'This event handles the part where you minimize the main form, hides it and shows the notify icon. Private Sub frmMain_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize If cbMinimize.Checked = True Then If Me.WindowState = FormWindowState.Minimized Then Me.Hide() NotifyIcon1.Visible = True End If End If End Sub #End Region
The code above will only make the program minimize to the system tray if cbMinimize has been checked by the user.
Also you will need to select an icon for the NotifyIcon or once minimized it won't appear.