A have created a form as a custom menu but I don't know how to close it if I click outside it (same behaviour as a contextmenu). The form i opened when I right-click on a datagrid.
If i put me.close() in 'Private Sub Form9_LostFocus(By...Handles MyBase.LostFocus' then the form closes directly after it opens... Maby because it contains buttons, labels, comboboxes...
Of course if you are feeling brave, there is a way you could almost certainly get the exact effect that you require.
To do this you would need to handle the WndProc event (from the overrides section) and check all the mouse messages to see if they represent a click away from your form.
This is something I personally wouldn't do unless there was no other solution - probably someone like Chiph, if he reads this could give you a helping hand.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.