Modifica

Condividi tramite


Menu.MenuItemCollection.Find(String, Boolean) Method

Definition

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

public:
 cli::array <System::Windows::Forms::MenuItem ^> ^ Find(System::String ^ key, bool searchAllChildren);
public System.Windows.Forms.MenuItem[] Find (string key, bool searchAllChildren);
member this.Find : string * bool -> System.Windows.Forms.MenuItem[]
Public Function Find (key As String, searchAllChildren As Boolean) As MenuItem()

Parameters

key
String

The name of the menu item to search for.

searchAllChildren
Boolean

true to search child menu items; otherwise, false.

Returns

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

Exceptions

key is null or an empty string.

Remarks

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.

Applies to