IndexOf Method

Control.ControlCollection.IndexOf Method

Retrieves the index of the specified control in the control collection.

[Visual Basic]
Public Function IndexOf( _
   ByVal control As Control _
) As Integer
public int IndexOf(
 Control control
public: int IndexOf(
 Control* control
public function IndexOf(
   control : Control
) : int;


The Control to locate in the collection.

Return Value

A zero-based index value that represents the position of the specified Control in the Control.ControlCollection.


If the control is not found in the collection, the IndexOf method return value is -1.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

Control.ControlCollection Class | Control.ControlCollection Members | System.Windows.Forms Namespace

© 2016 Microsoft