This documentation is archived and is not being maintained.
Control.SetTopLevel Method
.NET Framework 1.1
Sets the control as the top-level control.
[Visual Basic] Protected Sub SetTopLevel( _ ByVal value As Boolean _ ) [C#] protected void SetTopLevel( bool value ); [C++] protected: void SetTopLevel( bool value ); [JScript] protected function SetTopLevel( value : Boolean );
Parameters
- value
- true to set the control as the top-level control; otherwise, false.
Exceptions
| Exception Type | Condition |
|---|---|
| InvalidOperationException | The value parameter is set to true and the control is an ActiveX control. |
| Exception | The GetTopLevel return value is not equal to the value parameter and the Parent property is not a null reference (Nothing in Visual Basic). |
Remarks
If you call the SetTopLevel method of a Form and pass in a value of false, the form will not be visible until you call SetTopLevel again, passing in a value of true.
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 Framework Security:
- UIPermission to set the control as a top-level control if it is of type Form. This permission is only demanded if the value parameter is true and the control is not an ActiveX control. Associated enumeration: UIPermissionWindow.SafeTopLevelWindows
- UIPermission to set the control as a top-level control if it is of any type other than Form. This permission is only demanded if the value parameter is true and the control is not an ActiveX control. Associated enumeration: UIPermissionWindow.AllWindows
See Also
Control Class | Control Members | System.Windows.Forms Namespace | GetTopLevel
Show: