473,383 Members | 1,891 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,383 software developers and data experts.

MenuStrip

Hi,
I have a menustrip that has 3 main menus and various number of menus below
them...
I am trying to figure out how i can loop through the main menus and then
loop through each one of the main menus to get their items and .text field.
Any help....
Brian
Sep 11 '08 #1
2 2950
On Sep 11, 6:26*am, "Brian" <bsgalla...@community.nospamwrote:
Hi,
I have a menustrip that has 3 main menus and various number of menus below
them...
I am trying to figure out how i can loop through the main menus and then
loop through each one of the main menus to get their items and .text field.
Any help....
Brian
For example you have a MenuStrip1 and loop through items to get all
the item names as follows:

For x As Integer = 0 To MenuStrip1.Items.Count - 1
MsgBox(MenuStrip1.Items(x).Text)
Next

' ..Do the same iteration for other MenuStrip2 and 3...

Hope this helps,

Onur Güzel
Sep 11 '08 #2
This works for me.

Dim mStrip As MenuStrip = ctl (ctl comes from the whole control collection
over
which I am iterating)
Dim mItem As ToolStripMenuItem
Dim mSubItem As ToolStripMenuItem
Dim i As Int16, j As Int16, k As Int16

For i = 0 To mStrip.Items.Count - 1
mItem = CType(mStrip.Items.Item(i), ToolStripMenuItem)
MsgBox(mItem.Text)
' now look for sub menu items
For j = 0 To mItem.DropDownItems.Count - 1
MsgBox(mItem.DropDownItems(j).Text)
' now look for sub sub menu items (thats as far as we go)
mSubItem = mItem.DropDownItems(j)
For k = 0 To mSubItem.DropDownItems.Count - 1
MsgBox(mSubItem.DropDownItems(k).Text)
Next k
Next j
Next i

--
stullhe104
"Brian" wrote:
Hi,
I have a menustrip that has 3 main menus and various number of menus below
them...
I am trying to figure out how i can loop through the main menus and then
loop through each one of the main menus to get their items and .text field.
Any help....
Brian
Sep 11 '08 #3

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

Similar topics

5
by: Alvo von Cossel I | last post by:
hi, i have a modern looking application without the cotrolbox-bar because i've created my own. i have a restore down button with an image that has a grey background. if the user has a different...
0
by: rellik | last post by:
Hi All, I've run into a problem with the MenuStrip control and any help would be greatly appreciated! The problem I've got is that when use a control derived from the MenuStrip class all MDI...
0
by: academic | last post by:
Using ToolStripManager.Merge(ToolStrip,ToolStrip) I've been able to merge a MenuStrip into a MenuStrip but never a ContextMenuStrip into a MenuStrip. From the docs it seems to me I should be...
0
by: Chris Peeters | last post by:
Hi, I have an MDI-application running with 1 MDI chilld showing in 'Normal'-WindowState, so NOT maximized. What I see is the MDI-main window showing its title bar, below that the menustrip with...
1
by: Schwammkopf | last post by:
Hi ! I'm using Visual Studio 2005 Professional Edition and C#. I have a simple question: I want to add to my form, which is a scrollable control, a menustrip and statusstrip. The problem is...
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...
3
by: Gav | last post by:
I am using a MenuStrip on a form and adding a Panel to the same form in the program. When the Panel is added the top of the Panel is behind the MenuStrip, so the top of the Panel is hidden. How do...
0
by: kyungdongkim | last post by:
Hi, I have a dynamically generated MenuStrip following this example: http://www.codeproject.com/useritems/Dynamic_MenuStrip.asp Basically the menu strip allows users to save and load reports. ...
3
by: ssknov | last post by:
hi i am creating a login page.Inthe form load itself i need to hide the MenuStrip in MDI Parent to HIDE, When the users gives the correct passwd and pushes the Loginbutton , My MDIParent1 forms...
1
by: Alexander Vasilevsky | last post by:
How placing text in MenuStrip, glued it to the right side MenuStrip? http://www.alvas.net - Audio tools for C# and VB.Net developers + Christmas discount
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.