Export (0) Print
Expand All

Control.ControlCollection.SetChildIndex Method

Sets the index of the specified child control in the collection to the specified index value.

[Visual Basic]
Public Sub SetChildIndex( _
   ByVal child As Control, _
   ByVal newIndex As Integer _
)
[C#]
public void SetChildIndex(
 Control child,
 int newIndex
);
[C++]
public: void SetChildIndex(
 Control* child,
 int newIndex
);
[JScript]
public function SetChildIndex(
   child : Control,
 newIndex : int
);

Parameters

child
The child Control to search for.
newIndex
The new index value of the control.

Exceptions

Exception Type Condition
ArgumentException The child control is not in the Control.ControlCollection.

Remarks

When SetChildIndex is called, the Control referred to by the child parameter is moved to the position specified by newIndex and the other Control references in the Control.ControlCollection are reordered to accommodate the move. The control with an index value of zero is at the top of the z-order, and higher numbers are closer to the bottom.

Requirements

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 | GetChildIndex

Show:
© 2015 Microsoft