Click here to Skip to main content
Click here to Skip to main content

Tagged as

Minimize Form in System Tray

, 12 Feb 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
Note that you must select NotifyIcon1 from the ToolBox and set any icon to its icon property plus make 3 buttons or you can write minimize to tray code in the form closing event.Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As...
Note that you must select NotifyIcon1 from the ToolBox and set any icon to its icon property plus make 3 buttons or you can write minimize to tray code in the form closing event.
 
Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles Button1.Click
        Me.WindowState = FormWindowState.Minimized
    End Sub
 
    Private Sub Button2_Click(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles Button2.Click
        Application.Exit()
    End Sub
 
    Private Sub Button3_Click(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles Button3.Click
        Me.WindowState = FormWindowState.Minimized
        Me.Visible = False
        NotifyIcon1.Visible = True
    End Sub
 
    Private Sub NotifyIcon1_MouseDoubleClick(ByVal sender As System.Object, _
        ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseDoubleClick
        Me.Visible = True
        Me.WindowState = FormWindowState.Normal
        NotifyIcon1.Visible = False
    End Sub
End Class

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

No Biography provided

Comments and Discussions

 
GeneralMy vote of 1 Pinmemberalex.barylski20-Feb-13 7:23 
QuestionAlternate Pinmemberaspdotnetdev12-Feb-10 20:59 
What does your alternate have to do with your tip/trick? Typically, alternates would be used to list alternate ways of accomplishing the same thing that is done in the tip/trick. I'm not sure what your alternate does, but it seems to be unrelated to your tip/trick.
 
Also, just an FYI, I formatted your code for you trip trick. I didn't format your code for your alternate because I'm thinking of deleting it for you (unless you have a good reason for keeping it there).
AnswerRe: Alternate PinmvpLuc Pattyn23-Jul-10 4:55 
GeneralRe: Alternate Pinmemberaspdotnetdev23-Jul-10 6:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.1411023.1 | Last Updated 13 Feb 2010
Article Copyright 2010 by Pratik M Mahajan
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid