?
Solved

Which Control Has The Focus?

Posted on 1998-12-02
7
Medium Priority
?
218 Views
Last Modified: 2011-09-20
Is there a way to find out which control on a certain form currently got the focus?
0
Comment
Question by:lyka090898
[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
7 Comments
 
LVL 14

Expert Comment

by:waty
ID: 1447798
Use the Screen.ActiveControl
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 1447799
explain more please

0
 
LVL 14

Expert Comment

by:waty
ID: 1447800
the Screen.ActiveControl always contains the control wich has the current focus in your application.

Screen.ActiveForm contains the form wich the focus.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 3

Expert Comment

by:traygreen
ID: 1447801
Typically you trap to find the information re the ActiveControl.
Eg you have an array of text boxes (named txtInfo) and a combo box (named cboMyCombo) and wanted to trigger one of the controls events.  The code would look something like this....

Select Case UCase(ActiveControl.Name)
   Case "TXTINFO"
      Call txtInfo_LostFocus(ActiveControl.Index)

   Case "CBOPMYCOMBO"
      Call cboMyCombo_Click
End Select
0
 

Author Comment

by:lyka090898
ID: 1447802
waty, I believe that traygreen has provided a more explanatory answer.

so, traygreen, please post your comment as a proposed answer to get the points.
0
 
LVL 3

Accepted Solution

by:
traygreen earned 150 total points
ID: 1447803
Comment
       From: traygreen
                                                                              Date: Wednesday, December 02 1998 - 09:29AM PST

       Typically you trap to find the information re the ActiveControl.
       Eg you have an array of text boxes (named txtInfo) and a combo box (named cboMyCombo) and wanted to trigger one of the
       controls events.  The code would look something like this....

       Select Case UCase(ActiveControl.Name)
          Case "TXTINFO"
             Call txtInfo_LostFocus(ActiveControl.Index)

          Case "CBOPMYCOMBO"
             Call cboMyCombo_Click
       End Select
0
 
LVL 14

Expert Comment

by:waty
ID: 1447804
How you want, but the more general way (I use it always) is using the screen.ActiveControl
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

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…
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…
Suggested Courses
Course of the Month12 days, 20 hours left to enroll

777 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