?
Solved

VB.NET 2005 - How do I add my program as an icon in the bottom right of the taskbar?

Posted on 2006-04-14
6
Medium Priority
?
568 Views
Last Modified: 2009-04-20
VB.NET 2005 - How do I add my program as an icon in the bottom right of the taskbar?

When I minimize my application I don't want to be in the task area but instead in the tray on the bottom right?

Is there a way to do this using an object in the framework or do I have to resort to the API?
0
Comment
Question by:Hepen
  • 3
  • 2
6 Comments
 
LVL 9

Expert Comment

by:jrscherer
ID: 16458594
Hi Hepen,
I think you are looking for the functionality of the control NotifyIcon. This is a standard control in your ToolBar.

Regards, Jack.net
0
 

Author Comment

by:Hepen
ID: 16458602
I added it to my form. How do I use it? When I minimize my applicaiton I Just want it to go away and only remain in the bottom right corner then when I double click it or single click it, it will bring my application back
0
 
LVL 9

Accepted Solution

by:
jrscherer earned 1400 total points
ID: 16458679
First, give it an icon to make it visible in your tray. Also give it a text.

then add the two following event handler to your form:

    ' this will make the NotifyIcon visible when your form is minimized
    Private Sub Form1_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.SizeChanged
        NotifyIcon1.Visible = (Me.WindowState = FormWindowState.Minimized)
    End Sub

    ' this will restore the window when you double-click the NotyfyIcon
    Private Sub NotifyIcon1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles NotifyIcon1.DoubleClick
        Me.WindowState = FormWindowState.Normal
    End Sub

You may also add single click event handler and context menues

Jack.net
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 86

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 600 total points
ID: 16458695
Set the Visible property of the NotifyIcon to False.

Public Class Form1

    Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
        If Me.WindowState = FormWindowState.Minimized Then
            NotifyIcon1.Visible = True
            Me.Hide()
        End If
    End Sub

    Private Sub NotifyIcon1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles NotifyIcon1.DoubleClick
        Me.Show()
        Me.WindowState = FormWindowState.Normal
        NotifyIcon1.Visible = False
    End Sub

End Class
0
 
LVL 9

Expert Comment

by:jrscherer
ID: 16458712
Idle Mind,
You are right the Notify Icon visibility should be false at the start.
Question: why would you use Me.Show and Me.Hide, since these functions are intrinsic in the FormWindowState?
Jack.net (with highest respect of your competence)
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 16461018
@jrscherer...

The authors second statement was:

    "When I minimize my application I don't want to be in the task area but instead in the tray on the bottom right?"

I use Me.Hide to make the form disappear from the taskbar.  Your code leves the forms entry in the taskbar.

=)
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month13 days, 20 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question