VB.Net
  Home arrow VB.Net arrow Page 5 - Simple VB.NET Notify Icon with Panel Appli...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
Moblin 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
VB.NET

Simple VB.NET Notify Icon with Panel Application
By: R. Abhiram Vikrant
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 87
    2003-10-05

    Table of Contents:
  • Simple VB.NET Notify Icon with Panel Application
  • Notify What?
  • The Application
  • Context Menu
  • Let's Get Cookin'!
  • The Code

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Simple VB.NET Notify Icon with Panel Application - Let's Get Cookin'!


    (Page 5 of 6 )

    We’ll now switch our attention to the coding aspect, where we will apply the programming logic.  Select the form and double click it, the code in the “code view” will provide you with the Form_Load event handler and enter the code as shown below.

      Private Sub Form1_Load (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

            nfi.Visible = False   'hide the icon when the form loads
            Panel1.Visible = True   ' show only Panel1 during the start
            Panel2.Visible = False   'hide the panel2 

    End sub

    Double click the button labeled Panel1; the code below will be displayed in the code view:

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        End Sub

    We want the above sub-routine to be executed when pan1 (context menu item)   is clicked, so add the following click event to the above code and it goes as:

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click,pan1.click

    Hence this sub will be triggered either when the button is clicked or when the Notify Icon menu item Panel1 (pan1) is clicked.

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click,pan1.click

    Me. Visible = True 'make sure that the form is displayed first if it's been triggered from notify icon
    Panel1.Visible = True ' activate the first panel
    Panel2.Visible = False ' hide the second panel
    End Sub

    Do the same for the Button2_click event handler.  In the code view there will be two drop-down boxes with the components name in them.  The left-hand drop-down box lists the components in the current form and the right-hand drop-down box lists the methods of selected components.

    From the left-hand box select the LinkLabel1 control.  From the right-hand select the click event.  You will be provided with the link label click event handler which we’ll code here:

    Private Sub LinkLabel1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkLabel1.Click

            Me.Visible = False ' hide the form
            nfi.Visible = True ' show the notify icon in the system tray

        End Sub

    We want the application to be visible when the Iotify Icon is double clicked, so select the notify icon (nfi) from the drop down box in the code view and select the double click event from the associated events:

    Private Sub nfi_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles nfi.DoubleClick

    Me.Visible = True
    nfi.Visible = False

        End Sub

    Select the exit menu item and double click it.

    Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click

    Me.close()

        End Sub

    Bingo! We are done now. Build the application and run it. The complete run of the code follows next:

    More VB.Net Articles
    More By R. Abhiram Vikrant


     

    VB.NET ARTICLES

    - MyClass - Implementing Polymorphism in VB.Net
    - Building a News Ticker Using VB.Net
    - Everything You Wanted to Know About Forms In...
    - Building Assemblies with VB.Net
    - Simple VB.NET Notify Icon with Panel Applica...
    - Regular Expressions in .NET
    - String Encryption With Visual Basic .NET
    - Deploying Applications in VB.NET: Part 1/2
    - Watching Folder Activity in VB.NET
    - Creating A Windows Service in VB.NET
    - Implementing The Google Web Service In VB.NET
    - Migrating to Visual Basic.NET from Visual Ba...







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway