Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to highlight a text field

Status
Not open for further replies.

Retar

Technical User
Feb 28, 2001
4
US
my program has many text field which needs to be filled out by the user. I want that each time the user navigate through the text fields using Tab or the mouse that the content of the text field gets highlighted. This way if the user wishes to change the data he doesn't need to erase then write , he can just type over...

thanks in advance !
 
Put two text boxes on a form called Text1 and Text2. Then enter this code in the code window of the form.

Option Explicit

Private Sub Text1_GotFocus()
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End Sub

Private Sub Text2_GotFocus()
Text2.SelStart = 0
Text2.SelLength = Len(Text2.Text)
End Sub

Use Tab to go between the two text boxes and you'll see how they get highlighted. Snaggs
tribesaddict@swbell.net
2 wire mesh butchering gloves:
1 5-finger, 1 3-finger, pair: $15
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top