×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Highlight

Highlight

Highlight

(OP)
I am a new programmer and have written a few programs but I would like to know how to highlight a text field when tabing thru the program at runtime.  As of now when you go from field to field you must delete previous information then type the new info.  I would like the old info highlighted so when you start typing it replaces the old info.  I can not seem to find it in the properties of the text box.  Is it in there and not obvious or is it a line of code that must be put into the program.  I would be much appriciative of any responses.

Thank you,

jscorpion

RE: Highlight

If you are using VBA in Office then change the AutoWordSelect property of the textbox to true. If that is not available, then you can insert this code into your form.

'The textboxes are set up in a control array
Private Sub Text1_GotFocus(Index As Integer)
    Call AutoSelect
End Sub

Public Sub AutoSelect()
    Dim c1 As Control
    Set c1 = Screen.ActiveForm.ActiveControl
    If TypeOf c1 Is TextBox Then
        c1.SelStart = 0
        c1.SelLength = Len(c1)
    End If
    Set c1 = Nothing
End Sub

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close