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.
[Visual Basic] Public ReadOnly Property TopLevelControl As Control [C#] public Control TopLevelControl {get;} [C++] public: __property Control* get_TopLevelControl(); [JScript] public function get TopLevelControl() : Control;
Property Value
The Control that represents the top-level control that contains the current control.
Remarks
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.
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
.NET Framework Security:
- UIPermission for all windows to get this property value. Associated enumeration: UIPermissionWindow.AllWindows
See Also
Control Class | Control Members | System.Windows.Forms Namespace | Form