This documentation is archived and is not being maintained.

Control.ContainsFocus Property

Gets a value indicating whether the control, or one of its child controls, currently has the input focus.

[Visual Basic]
Public ReadOnly Property ContainsFocus As Boolean
public bool ContainsFocus {get;}
public: __property bool get_ContainsFocus();
public function get ContainsFocus() : Boolean;

Property Value

true if the control or one of its child controls currently has the input focus; otherwise, false.


You can use this property to determine whether a control or any of the controls contained within it has the input focus. To determine whether the control has focus, regardless of whether any of its child controls have focus, use the Focused property. To give a control the input focus, use the Focus or Select methods.


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 | CanFocus | Focus | Focused | CanSelect