This documentation is archived and is not being maintained.

Control.HasChildren Property

Gets a value indicating whether the control contains one or more child controls.

[Visual Basic]
Public ReadOnly Property HasChildren As Boolean
[C#]
public bool HasChildren {get;}
[C++]
public: __property bool get_HasChildren();
[JScript]
public function get HasChildren() : Boolean;

Property Value

true if the control contains one or more child controls; otherwise, false.

Remarks

If the Controls collection has a Count greater than zero, the HasChildren property will return true. Accessing the HasChildren property does not force the creation of a Control.ControlCollection if the control has no children, so referencing this property can provide a performance benefit when walking a tree of controls.

Requirements

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

See Also

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

Show: