I have an app with 2 forms (main and help.) And when I click on a menu item in the main form a (modeless) help form is visible.
When I close the help form I want the main form to have the focus and enable the help menu item. And this works when I use the help form's close (such as clicking on the X button.) But it doesn't work when I right click on the help form in the taskbar and choose "Close window".
I've tried various things to fix this (form activate(), lostfocus, putting the code in form closed.) But the only way I can get the focus to go back onto the first form (after doing the right click) is if I put a msgbox in the closing sub.
But I don't want a msgbox in my sub. So can someone please tell me how to solve this?
Thank you.
When I close the help form I want the main form to have the focus and enable the help menu item. And this works when I use the help form's close (such as clicking on the X button.) But it doesn't work when I right click on the help form in the taskbar and choose "Close window".
I've tried various things to fix this (form activate(), lostfocus, putting the code in form closed.) But the only way I can get the focus to go back onto the first form (after doing the right click) is if I put a msgbox in the closing sub.
VB.NET:
Private sub Form2_closing (sender As Object, e As FormClosingEventArgs) Handles Me.Closing
msgbox ("Closing.")
mainform.mnuhelp.Enabled = True
End Sub
But I don't want a msgbox in my sub. So can someone please tell me how to solve this?
Thank you.