Results 1 to 3 of 3

Thread: question about current focus on a form

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2000
    Posts
    168
    is there a way to return the current object that has the focus? for example when the user hits F1, it says what the current control/object they are in is?

    thanks,
    Thai

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Set the form.keypreview=true, then insert this to your form:

    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 112 Then MsgBox Me.ActiveControl.Name
    End Sub


    Hope it works!

  3. #3
    New Member
    Join Date
    Feb 2000
    Posts
    7
    You can also use the api call GetFocus(). It returns a handle to the control that is currently in focus. You can use other api calls to get the name.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width