locked
When is the LostFocus event actually fired? RRS feed

  • Question

  • Hello!

    In the documentation it reads "Occurs when the control loses focus". As far as I understand e.g. a TabPage's LostFocus event should fire when focus leaves the page, e.g. by putting focus at anoter page or outside the TabControl. I suppose I may explicitly assign focus at a control by clicking on it with the mouse (under the assumption it's enabled and so on), but the TabPage's LostFocus event doesn't fire in this case?

    Shouldn't the TabPage LostFocus fire in such a case or do I miss something?


    Best regards,

    Henrik Dahl
    Wednesday, May 18, 2005 7:22 AM

Answers

  • Rarely should the LostFocus and GotFocus events be used, hence why they don't show up in the designer.

    Instead use the Enter and Leave events. Leave will fire when you leave a tab page or a control that is contained on the tab page.

    Wednesday, May 18, 2005 9:37 AM

All replies

  • Rarely should the LostFocus and GotFocus events be used, hence why they don't show up in the designer.

    Instead use the Enter and Leave events. Leave will fire when you leave a tab page or a control that is contained on the tab page.

    Wednesday, May 18, 2005 9:37 AM
  • It works excellently, thank you very much!


    Best regards,

    Henrik Dahl
    Wednesday, May 18, 2005 4:44 PM
  • It's just a pitty that the Leave event does not exist in the Compact .NET Framework, whereas the LostFocus event does.


    Best regards,

    Henrik Dahl
    Wednesday, May 18, 2005 10:04 PM