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


Type: System.String

The name of the menu item to search for.

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

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