Results 1 to 8 of 8

Thread: [RESOLVED] Check control got focus or not

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    145

    Resolved [RESOLVED] Check control got focus or not

    Hi,

    I have two control on form1
    How to check control1 got focus or not from an sub or procedure ?

  2. #2
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: Check control got focus or not

    write a MsgBox in your control's GotFocus Event and that code will get executed once that control got focus. or in a form you can check with this code
    VB Code:
    1. Me.ActiveControl.Name
    this will give you current control's name
    If an answer to your question has been helpful, then please, Rate it!

    Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.


  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    145

    Re: Check control got focus or not

    thanks
    Try it, it work.
    But there is other method then this? (Me.ActiveControl.Name)
    Last edited by barianto; Aug 23rd, 2006 at 04:51 AM.

  4. #4
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: Check control got focus or not

    I use only these codes...Im not sure is there any other methods
    If an answer to your question has been helpful, then please, Rate it!

    Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.


  5. #5
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Check control got focus or not

    why would you need another method?

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    145

    Re: Check control got focus or not

    coz, i want to make it generic, i don't want to compare it to each control i have
    Last edited by barianto; Aug 23rd, 2006 at 10:48 PM.

  7. #7
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: Check control got focus or not

    Quote Originally Posted by barianto
    coz, i don't want to make it generic, i don't want to compare it to each control i have

    It wont........ I will return the current active Control (name). Perfect for your Sub()!

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    145

    Re: Check control got focus or not

    Ok then. This is resolved

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