System.Windows.Forms.ToolStripItemCollection.IndexOfKey Method

Retrieves the index of the first occurrence of the specified item within the collection.

Syntax

public virtual int IndexOfKey (string key)

Parameters

key
The name of the System.Windows.Forms.ToolStripItem to search for.

Returns

A zero-based index value that represents the position of the first occurrence of the System.Windows.Forms.ToolStripItem specified by the key parameter, if found; otherwise, -1.

Remarks

The key parameter value corresponds to the ToolStripItem.Name property.

If ToolStripItemCollection.IndexOfKey(string) is called successively, the last returned index will be checked for a key match first, and if there is no match, the search starts at the beginning of the collection.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0