Minimize to Tray

/ Published in: VB.NET
Save to your folder(s)

When the form minimizes it will hide and make an "Notifyicon" in the taskbar, when clicked it will reopen the form. I suggest adding a ContextMenuStrip to the notify icon to make right clicking possible.

Copy this code and paste it in your HTML
  1. Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
  2. If Me.WindowState = FormWindowState.Minimized Then
  3. Me.Hide()
  4. End If
  5. End Sub
  6. Private Sub NotifyIcon1_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseClick
  7. If Me.WindowState = FormWindowState.Minimized Then
  8. Me.Show()
  9. Me.WindowState = FormWindowState.Normal
  10. End If
  11. End Sub

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.