Solved

How to remove focus from the combo box?

Posted on 2006-07-21
6
2,149 Views
Last Modified: 2007-12-19
Hi,

I have a vb 6 activeX project. When the execution of my program finishes, the cursor is automatically placed in the combo box . The combo box and a frame are the only controls that are visible during this time. Is it possible to remove focus from the combo box when execution finishes? the reason I need to do is that when users scroll down after execution, they are actually scrolling through the driopdown and not the page.  The frame has some labels embedded in it. I tried setting focus on the frame or label, but it doesnt have setfocus property. Basically, I want to remove focus from the conmbo box .

Thanks for any help.
0
Comment
Question by:pmud
6 Comments
 
LVL 17

Expert Comment

by:CSecurity
ID: 17155648
Try this:

Private Sub Combo1_Click()
Label1.SetFocus
End Sub
0
 
LVL 17

Accepted Solution

by:
CSecurity earned 500 total points
ID: 17155655
For sure Label object doesn't have SetFocus. Then you should try another object.

You can add 1 Textbox. So little (height and width can be a number like 120)
Then set the top = -1000

To be not visible but it should exist in form (visible = false would not work)

Then set focus on that object...;) [This is just a trick]
0
 
LVL 13

Expert Comment

by:jmundsack
ID: 17155668
What do you mean "and not the page"?  What are they scrolling through when they're scrolling through the "page"?  Is it a web page?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 9

Expert Comment

by:Rob_Jeffrey
ID: 17156509
When your code is finshed executing - would it work to set the combobox.enabled=false?
You  may wish to do that to all visible controls - to stop confusion.  You may want to add another button that re-enables the control if further interaction is required.  On startup make it cmdButton.visible=false and set it visible when disabling the combobox.

I don't know if this is a good idea - I havn't seen your project.
0
 

Author Comment

by:pmud
ID: 17157400
Hi CSecurity,

That works perfectly. :)

Thanks
0
 
LVL 17

Expert Comment

by:CSecurity
ID: 17161298
You're welcome... I was used that trick before :p :D
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now