Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > Pro VB.NET 2002/2003
|
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 18th, 2004, 10:08 PM
Registered User
 
Join Date: Mar 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Who can help me set up a contextmenu for tray icon


Hello,

Can somebody help me creat a tray icon contextmenu, so when you right click the icon the
menu appears. Also, when an item is clicked on the menu,
the tray icon's form will appear or disappear?

I have the following code for the problem but it does not seem to do much.

thanks,

 Bruce

Sub Createcontextmenu()


        Dim ctx As New ContextMenu()

        With ctx.MenuItems
            .Add(New MenuItem("Click to Restore Form", AddressOf icnContext_Click))
            .Add(New MenuItem("Click to Minimize Form", AddressOf icnContext_Click))
            .Add(New MenuItem("Exit", AddressOf icnContext_Click))

        End With


        icnContext.ContextMenu = ctx


    End Sub



    Private Sub icnContext_Click(ByVal sender As Object, ByVal e As System.EventArgs)

        Dim mi As MenuItem = DirectCast(sender, MenuItem)

        Select Case mi.Text

            Case "Click to Restore Form"
                Me.Visible() = True
            Case "Click to Minimize Form"
                Me.Visible() = False
            Case "Exit"
                Me.Close()


        End Select




    End Sub
End Class


 
Old May 26th, 2004, 02:20 AM
Authorized User
 
Join Date: Apr 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to tact_259
Default

Hello!

As you know there is a control NOTIFYICON on tool box in vb.net. Use it and set the context menu property of it to the context menu that is created using another control CONTEXT MENU placed on tool box.

on that menu please try your code for hiding or unhiding form.
I Think this will help you.
Bye

Arun Kumar
B-259, Vaishali Nagar,
Jaipur-302021
Rajasthan
India





Similar Threads
Thread Thread Starter Forum Replies Last Post
system tray icon spoboyle Apache Tomcat 1 June 9th, 2004 10:29 AM
Contextmenu for a tray icon problem? koolvbnet1 VB How-To 0 March 17th, 2004 12:27 PM
Contextmenu for a tray icon problem? koolvbnet1 VB.NET 0 March 8th, 2004 05:36 PM
Tray icon contextmenu function problem? koolvbnet1 Pro VB.NET 2002/2003 0 March 8th, 2004 10:35 AM
Tray Icon Contextmenu Problem! koolvbnet1 VB.NET 2002/2003 Basics 0 March 8th, 2004 12:46 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.