DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2005
    Posts
    2

    Dynamic Context Menus

    I want to create a context menu dynamically during run time.

    easy enough with something like:

    For I = 1 To UBound(g_DispMenu)
    myForm.mnurightSlot.MenuItems.Add(g_DispMenu(I).Description)
    Next

    So the question becomes how do I handle some one clicking an item? I can not do something like this as I do not know how many menu items until run time?

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

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Look up the AddHandler statement in VB's online help.
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Oct 2005
    Location
    California
    Posts
    10

    Dynamic Context Menus

    For ASP.NET forms you can put the following in the page_Load method:

    if you have a control that you need the contex menu opened on, you can just put the following into the Page_Load method

    if control's id = "lblMyLabel"
    you would code the following:

    lblMyLabel.Attributes.Add("oncontext", "myJavascriptroutine");

    Romel Evans

Similar Threads

  1. Dynamic Context Menus
    By No-e in forum .NET
    Replies: 1
    Last Post: 09-19-2005, 11:56 AM
  2. IDesigner, Context Menus, and Verbs
    By byerkes in forum .NET
    Replies: 0
    Last Post: 06-23-2005, 11:19 AM
  3. dynamic nested menus
    By Brad Taylor in forum VB Classic
    Replies: 16
    Last Post: 03-29-2001, 09:21 AM
  4. dynamic nested menus
    By Brad Taylor in forum VB Classic
    Replies: 0
    Last Post: 03-26-2001, 04:37 PM
  5. Context Menus
    By RK in forum ASP.NET
    Replies: 0
    Last Post: 10-11-2000, 06:23 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links