Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 15,677 times

Related Categories

Don't lose focus in UserControls

Typically, to determine when a UserControl gains and loses focus,
you might think to use the standard GotFocus and LostFocus events.
However, in UserControls these two events aren't always reliable.
There are situations where a control will lose the focus without
firing the LostFocus event (for example, when Alt+Tabbing to
another application), and also get the focus without firing the
GotFocus event. As a result, your best bet for monitoring the
focus status is to insert code in the  UserControl's EnterFocus
and ExitFocus events.

© 2001 Element K Journals, a division of Element K Press LLC ("Element K"). Element K and the Element K logo are trademarks of Element K LLC

Comments

  • fershlerger Access and IE handle differently

    Posted by anniepoo on 03 Aug 2005

    It appears that this is handled inconsistently in various contexts.
    I was developing an ActiveX control in VB 6.0. The control contains a TextBox
    and I wanted to process the enter key. The control i...