troubleshooting Question

Control Not Losing Focus When Form Clicked

Avatar of Sling_Blade
Sling_BladeFlag for New Zealand asked on
Visual Basic.NET
4 Comments2 Solutions298 ViewsLast Modified:

I have several controls on my form (comboboxes and text boxes).

when I select a value from my combobox it will retain focus until I click into another control (by design).

The trouble with that is, if someone just clicks somewhere on the form itself the combobox still retains focus. If they then move the wheel button while the combobox has focus their selection in the combobox will change.

What I need to happen is for the combobox to lose focus as soon as the form OR any other control is clicked.

I have tried the myForm.ActiveForm.Focus() methood in the myForm_click event and it is not working for me.

I can get the focus event to fire for the other controls during the myForm_click event. However, I don't really want to arbitrarily force focus onto another control until the users chooses that control. What I really like to do is just remove focus from the combobox so the user doesn't accidentally choose the wrong item.

Is there a way I can force focus onto the form?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros