Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Professionals,

I am working in Visual basic. In my project, I have a form (Form1), not MDI, it is having few buttons. Clicking a particular button, another Form Pops up (Form2), this form is having Two Label controls with text. Form2 FormBorderStyle = None.
Now I want to create the situation that Clicking (Mouse Click) any where on the screen that is Desk Top, or clicking on any other application visible in desk top or clicking any where on the Form1 including Title Bar, Form2 will be come hidden. Clicking on any of the Form2 Labels also makes Form2 hidden.
This is like ComboBox. Once the drop down portion pops up, click any where drop down portion disappears. please note that when Form2 is shown focus is still on Form1.

Suggest a process.

What I have tried:

Do I need to capture the global Mouse Click ? Code on Selected Label Lost Focus does not work.
Posted
Comments
[no name] 30-May-21 16:22pm    
One could (normally) use the Deactivate event in Form2; but since you maintain that Form2 doesn't get focus (gets Activated), I guess you can't.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900