Gets a value indicating whether the menu item contains child menu items.
[Visual Basic] Overridable Public ReadOnly Property IsParent As Boolean [C#] public bool IsParent {override get;} [C++] public: __property virtual bool get_IsParent(); [JScript] public function get IsParent() : Boolean;
true if the the menu item contains child menu items; false if the menu is a standalone menu item.
You can use this property in conjunction with the Parent property to navigate in code through an entire menu structure.
The following example determines if there are any sub menus associated with a TBD called MenuItem1. If any sub menus exist, it disables them by setting the TBD property to false. The example assumes that there is a MenuItem object created named MenuItem1.
[Visual Basic]
Public Sub DisableMyChildMenus () ' Create a MenuItem to use with For..Each loop. Dim tempMenu As New MenuItem ' Determine if MenuItem2 is a parent menu. If MenuItem2.IsParent = True Then ' Loop through all the sub menus. For Each tempMenu In MenuItem2.MenuItems ' Disable all of the sub menus of MenuItem2. tempMenu.Enabled = False Next End If End Sub
MenuItem Class | MenuItem Members | System.WinForms Namespace