TopLevelControl Property
TOC
Collapse the table of content
Expand the table of content

Control.TopLevelControl Property

 

Gets the parent control that is not parented by another Windows Forms control. Typically, this is the outermost Form that the control is contained in.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

[BrowsableAttribute(false)]
public Control TopLevelControl { get; }

Property Value

Type: System.Windows.Forms.Control

The Control that represents the top-level control that contains the current control.

The top-level control is defined as the parent control that is not parented by another Windows Forms control. Typically, this is the outermost Form that the control is contained in. For example, if the control is contained on an MDI child Form, then the top-level control is the Multiple Document Interface (MDI) parent Form. If the control is not parented on a Form, this property will return null.

UIPermission

for all windows to get this property value. Associated enumeration: UIPermissionWindow.AllWindows

.NET Framework
Available since 1.1
Return to top
Show:
© 2016 Microsoft