how to find a menu item in menulist

  • Thread starter Thread starter venky
  • Start date Start date
V

venky

I have a menu with menuitems. i want to find a menu with text "Open"
from the menuitems. i don't see any function in menuitems or menu. is
there a way or i need to iterate through the list and compare the text?


raj
 
Hi Raj,

I think you'll find that the class(object) holding your items is a menu
class. This class has a collection of menitems. The menuitem class has a
text property and therefore you will get what you need this way.

HTH, Phil
 
Hi, to give you an example of what Phill means:

Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles MyBase.Load
LoopMenu(MainMenu1)
End Sub

Private Sub LoopMenu(ByVal Parent As Menu)
Dim mnuChild As MenuItem
For Each mnuChild In Parent.MenuItems
If mnuChild.Text = "Open" Then
MsgBox(mnuChild.Text)
End If
Call LoopMenu(mnuChild)
Next
End Sub

Hth, Greetz Peter
 
Back
Top