Menu.MenuItemCollection.Find Method (String, Boolean)

 

Finds the items with the specified key, optionally searching the submenu items

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public MenuItem[] Find(
	string key,
	bool searchAllChildren
)

Parameters

key
Type: System.String

The name of the menu item to search for.

searchAllChildren
Type: System.Boolean

true to search child menu items; otherwise, false.

Return Value

Type: System.Windows.Forms.MenuItem[]

An array of MenuItem objects whose Name property matches the specified key.

Exception Condition
ArgumentNullException

key is null or an empty string.

The key comparison is not case-sensitive. If the key parameter is null or an empty string, or there are no matches, Find returns an empty array.

The Name property corresponds to the key for a MenuItem in the Menu.MenuItemCollection.

.NET Framework
Available since 2.0
Return to top
Show: