473,395 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Add Menu Items Dynamically

Is it possible to dynamically add items to a menu and use one event handler
for click events?

If so, how do you detect which of the new items was clicked?

Thanks,
Tom
Nov 15 '05 #1
1 3876
Tom Bean wrote: In the handling routine, you'll be passed an object. Cast this object to
a MenuItem. You can then use any number of properties to distinguish
between various MenuItems.
A personal favourite is to use the "Tag" property of a menu to store enough
information (such as a string) which is used to interpret the the menu
click. I usually use the Magic library for menus (www.dotnetmagic.com), but
I'm assuming that the standard .NET menus have this also (it's common to all
[Control]s as far as I know.

HTH

Tobin
--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Humpty Dumpty | last post by:
Hi folks, here's a challenge: I have a dynamically created cascading menu in Tkinter that can be quite large because it is created from a file. I tried using lazy creation so only the menu item...
6
by: Sandy | last post by:
Hello - I have a book that illustrates pulling menu items from a Sql Server table into an ascx via a stored procedure. Is this something that is done in the real world? I do like the effect...
4
by: paula | last post by:
I've got a problem with asp.net i am trying to make a menu control. and have searched the web for serveral controls but they don't work correctly. I am pretty new to asp.net building. What am i...
10
by: tmaster | last post by:
When I try to dynamically add a second sub menu item to this ContextMenu item, I get an error 'Specified argument was out of the range of valid values'. Private Sub mnuTopics_Show_Select(ByVal...
20
by: MARLON LA ROSE | last post by:
CAN ANYONE TELL ME HOW I GET THE ACTUAL OBJECT OF A MENU ITEM. IS THERE A FILTER OR SOMETHING THAT I CAN USE. I HAVE BEEN FIGHTING WITH THIS FOR ABOUT 4 HOURS NOW AND I END UP GETTING THE SAME...
2
by: jack | last post by:
Hello, I need to dynamically add menu items to an existing menu on an MDI form. In the form load, when I create the menu items then add it to the menu control using the Add method, the entire...
1
by: xpnctoc | last post by:
Here's the 30,000-ft. view: I wrapped an asp:Menu control in an ascx control. When I try to dynamically populate the menu in the ascx control, the items appear, but clicking on them fails to trigger...
2
by: dorrit.Riemenschneider | last post by:
Hi, I develop a sharepoint webpart with ASP.Net 2.0 and therefore override CreateChildControls(). In CreateChildControls() I create dynamically a menu with items (and sub items) from a database....
0
by: Puja | last post by:
hi all, I have asp.net menu control on my page. I want to hide some menu and sub-menu items dynamically depending on user. (i.e after user is logged in) is there any property like ...
3
by: =?Utf-8?B?ZWFndWlsYXI=?= | last post by:
Hi, I am trying to dynamically generate a menu, based on entries on a text or xml file. The text file contains the "tree" after which the menu will need to be created. Something like the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.