473,325 Members | 2,342 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,325 software developers and data experts.

[ContextMenuStrip] How to list all items (menus and submenus)?

Leito
58
Hello,

I have a contextMenuStrip in my application and I would like to get a list of all items I have in it.
So I tried to use the property : this.contextMenuStrip.Items.

It's working fine, except that it's only returning me the list of menus (level 0) and neither the submenus (level 1) nor the subsubmenus (level 2)...

How could I do that? :)
Apr 30 '10 #1
2 3749
tlhintoq
3,525 Expert 2GB
You have to do a recursive search.
Just like getting all the files and folders within a folder, then for each folder you find you have to search it.

I would recommend putting your found items into a Treeview, again just like a directory search. That way you retain the hierarchy.

http://msdn.microsoft.com/en-us/library/bb513869.aspx
Apr 30 '10 #2
Leito
58
Thank you for that answer.

I simply used a ArrayList to store menus that I retrieve with a recursive function (I don't need to keep the hierarchy, so a list is simpler than a treeview)
.
May 5 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Ron M. Newman | last post by:
I have a context menu strip. I can Add elements to its "Items", but there is nothing in there to add a sub context menu strip. Menu Item 1 Item 2 Sub Item 1 <-- impossible to add! How do...
0
by: active | last post by:
For the last 3 or 4 days I've been, on an off, searching the Internet and theVS2005 Doc for an example of how to add a contextmenustrip to a menustrip. I can move all the items from a...
2
by: Academia | last post by:
I've been searing the Internet and get many many hits but never the answer to what I'm looking for. I want the same menu items (File, Edit, Preferences) and their sub-items (Open, Save; Cut,...
1
slapshock
by: slapshock | last post by:
Good day, please help me on my problem.... i want to create a context menu strip on run time but i got this error, please help me, i tried to search on the net but i cant fine any solution...
2
N002199B
by: N002199B | last post by:
Hie Guru's I am trying to write code that can be re-used by simple calls to build menus and submenus on mobile devices. I have heard about the cascading menus design pattern, but do not...
1
by: Mohit | last post by:
Hi All, 1. I have a context menu with some items in it. I have not assigned any key board shortcuts to any menu item. Now when the context menu is open and some key (say 'a') is pressed and if...
9
by: =?Utf-8?B?Z2luYWNyZXNzZQ==?= | last post by:
Hi, I have a form (Form1) with a ContextMenuStrip (ContextMenuStrip1). If I pass Form1 to a Utility Sub with the following code: Public Sub Utility(theForm as Object) with theForm For Each...
3
by: Bill Schanks | last post by:
VB.NET 2005 SP1... I have two drop down items on a contextmenustip: DropDown1 (Enabled) DropDown2 (Disabled) If i hover over dropdown1 to see the items, and then hover over dropdown2 it will...
2
by: eBob.com | last post by:
I've been working on an app which has an array of RichTextBoxes. And I have a context menu for the RTBs. The context menu has two levels; the first level has two items, "Load Sample Text File"...
1
by: Darin | last post by:
I understand microsoft's change from contextmenu to contextmenustrip - the strip looks "prettier". But, since the contextmenu isn't available in the designer, it suer woul dhave been nice when...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.