CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: How to....

  1. #1
    Join Date
    Aug 1999
    Location
    US, Florida
    Posts
    817

    How to....

    If text1 has focus then I need X = text1, if text2 has focus then I need X = text2, if text3 has focus then I need X = text3, etc.
    How can I do that?


  2. #2
    Join Date
    Sep 1999
    Location
    Red Wing, MN USA
    Posts
    312

    Re: How to....

    Use the ActiveControl Object which is a Reference to whichever Control is Currently Active, (Has Focus), ie.
    private Sub Form_Load()
    Timer1.Interval = 100
    End Sub

    private Sub Timer1_Timer()
    If TypeOf ActiveControl is TextBox then
    Caption = ActiveControl.Text
    else
    Caption = ""
    End If
    End Sub



    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]
    Aaron Young
    Senior Programmer Analyst (Red Wing Software)
    Certified AllExperts Expert

  3. #3
    Join Date
    Aug 1999
    Location
    US, Florida
    Posts
    817

    Re: How to....

    Thanks Aaron, just what I needed


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

Featured