In VB.NET LostFocus is not working on my MDI child container

630 views Asked by At

If I set up two forms, I can close one or the other by using the ".Close()" function on the form's handle. However, this does not work on Mdi Forms. The child form never seems to lose focus by clicking on any other child or the parent since the forms are all children of the parent. As long as the parent has focus, then children also have focus.

Is there a way to determine if the child form has lost focus and if so close it?

I use this for my regular (non-Mdi) forms and it works great:

AddHandler sub_menu.LostFocus, AddressOf close_menu

Thanks.

1

There are 1 answers

2
xpda On

When a form gets the focus, close all the MDI child forms that are not the ActiveMDIChild of the parent form.