Click to See Complete Forum and Search --> : How to....


AndyK
January 29th, 2000, 02:56 PM
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?

Aaron Young
January 29th, 2000, 03:19 PM
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
ajyoung@pressenter.com
aarony@redwingsoftware.com

AndyK
January 29th, 2000, 03:49 PM
Thanks Aaron, just what I needed :)