Before parsing submenu in ToolStripMenuItem what you must know is how deep your submenu. after that you can do parsing subMenu to all menu and add some action or etc. very usefull if you implement privilege every user to access the menu.
HowTo
1. Find how deep you subMenu
File (MainMenu)
|
Manage(SubMenu 1) ==> User(SubSubMenu2) | Change Password (SubSubMenu2)
--------
Exit
based on information above we can tell the deep is 2.
2. Create 3 Variable based on the depth
Dim mainmenu As ToolStripMenuItem
Dim submenudepth1 As ToolStripMenuItem
Dim submenudepth2 As ToolStripMenuItem
to parsing every submenu use this code :
For Each mainmenu In frmMain.MenuStrip.Items.OfType(Of ToolStripMenuItem)()
For Each submenudepth1 In mainmenu.DropDownItems.OfType(Of ToolStripMenuItem)()
For Each submenudepth2 In submenudepth1.DropDownItems.OfType(Of ToolStripMenuItem)()
'Do Something !! for example get name of an item menu or etc
Next
Next
Next
hope this help u :D