Posted By

bennyty on 03/07/10


to VBNet Tray minimize

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Minimize to Tray

 / Published in: VB.NET

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.

  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
Posted By: keidash on April 25, 2010

Is simple! thanks for the code.

You need to login to post a comment.