it's a property of System.Windows.Form.Control which is one of the base
classes of Form...
.NET Framework Class Library
Control.ContainsFocus Property
See Also
Control Class | Control Members | System.Windows.Forms Namespace | CanFocus
| Focus | Focused | CanSelect
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows
2000, Windows XP Home Edition, Windows XP Professional, Windows .NET Server
family
Language
a.. C#
b.. C++
c.. JScript
d.. Visual Basic
e.. Show All
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[C#]
public bool ContainsFocus {get;}[C++]
public: __property bool get_ContainsFocus();[JScript]
public function get ContainsFocus() : Boolean;Property Value
true if the control or one of its child controls currently has the input
focus; otherwise, false.
Remarks
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.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows
2000, Windows XP Home Edition, Windows XP Professional, Windows .NET Server
family
See Also
Control Class | Control Members | System.Windows.Forms Namespace | CanFocus
| Focus | Focused | CanSelect
----------------------------------------------------------------------------
----
Send comments on this topic.
© 2001 Microsoft Corporation. All rights reserved.
"copyco" <co****@anon.com> wrote in message
news:lF**************@newssvr22.news.prodigy.com.. .
Sounds good, but I don't seem to have that property. It doesn't come up
in the help search either. This is a Windows App, not a Web App.
Perhaps there's a difference.
Dominique Vandensteen wrote:
try ContainsFocus property
dominique
"copyco" <co****@anon.com> wrote in message
news:fn********************@newssvr11.news.prodigy .com...
I want to be able to test if my app's form has focus, (ie: not in
background, behind other windows). How can I do this? I tried the
Me.Focused, but that doesn't work. I think it's because a control
within the form actually has focus, so the Me.Focused would return
false. Thanks!