Home All Groups Group Topic Archive Search About

textbox enter or GotFocus

Author
20 Apr 2006 5:51 AM
Boki
Dear All,

What is the different between Enter and GotFocus events?

Best reagrds,
Boki.

Author
20 Apr 2006 6:01 AM
Cerebrus
>From the docs :

The GotFocus and LostFocus events are low-level focus events that are
tied to the WM_KILLFOCUS and WM_SETFOCUS Windows messages. Typically,
the GotFocus and LostFocus events are only used when updating UICues.

The Enter and Leave events should be used for all controls except the
Form class, which uses the Activated and Deactivate events.

Regards,

Cerebrus.
Author
20 Apr 2006 12:10 PM
Phill W.
Boki wrote:

> What is the different between Enter and GotFocus events?

GotFocus and LostFocus are "low-level" events that Our Friends in
Redmond would prefer us not to use any more.
Enter and Leave are their respective replacements.

Also, bear in mind the caution tone of this MSDN article:

http://msdn2.microsoft.com/en-us/library/system.windows.forms.control.gotfocus(VS.80).aspx


specifically

"Do not attempt to set focus from within the LostFocus event handler.
Doing so can cause your application or the operating system to stop
responding ..."

8-o

Regards,
     Phill  W.