Clicking on menu doesn't cause control to lose focus RRS feed

  • Question

  • Hi all,

    I have an MDI application with a child form containing lots of user controls. These controls perform some actions whenever they lose focus. This works fine as the user iterates through the controls. When the last control is used the user then selects a menu / toolbar option (on the parent form). This doesn't cause the last control to lose focus/be validated.

    Any ideas how I can get around this?


    Thursday, September 11, 2008 8:02 AM


  • hi,

    To cause the last control to lose focus , you can add the Deactivate event of the form .

    this.Deactivate+=new EventHandler(Form1_Deactivate)

    add the code in 'Form1_Deactivate'.

    To get the last control ,you can use a public object to store a control when the control is focused.

    Hope that can help you.

    best regards,

    • Proposed as answer by Harry Zhu Thursday, September 18, 2008 2:32 AM
    • Marked as answer by jack 321 Monday, September 22, 2008 2:00 AM
    Monday, September 15, 2008 5:52 AM