Is there a way to start a loop and get all the Menu's and MenuItems on a form ???
Printable View
Is there a way to start a loop and get all the Menu's and MenuItems on a form ???
Try something like this..
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim m As Menu = Me.Menu RecursiveMenuSearch(m) End Sub Private Sub RecursiveMenuSearch(ByVal ParentMenu As Menu) If TypeOf ParentMenu Is MenuItem Then Diagnostics.Debug.WriteLine(CType(ParentMenu, MenuItem).Text) End If For Each mnu As Menu In ParentMenu.MenuItems RecursiveMenuSearch(mnu) Next End Sub
Aah... bugger.
I just spent 20 minutes trying to figure this one out. Here was my feeble attempt.
VB Code:
Dim objMItem As MenuItem For Each objMItem In Me.MainMenu1.MenuItems Debug.Write("objmitem") MessageBox.Show(objMItem.Text.ToString) Next
:feelingquitestupidrightnow: :(
many tx.