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
Solved

How to remove focus from the combo box?

Posted on 2006-07-21
6
2,341 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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
VBA error replacing data 6 40
Hide vba in gp 7 104
Recommendation vb6 to vb.net or others 14 176
Inserting a datasheet query into the body of an email using VBA? 4 20
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

828 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