Solved

How to remove focus from the combo box?

Posted on 2006-07-21
6
2,414 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SSRS expression Issue finding a string 10 101
SLMGR Switches Are Not Working On KMS Host 3 144
RUNRMTCMD from AS/400 13 100
VBA - If Bookmark = "XXBOOKMARKXX" then 15 51
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

733 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