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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Highlight text in textbox

Status
Not open for further replies.

countdrak

Programmer
Jun 20, 2003
358
US
I open a new form with a single textbox when the user does something. I want the text in the textbox to be highlighted when it shows up. How do I do that?

Thanks.
 
Alter the background colour of the textbox when the user performs the action you want. What action is it they have to do?
 
Sorry maybe I wasnt really clear. I have a form- call it form1. I tab out(lose focus) from a text field in form1. A new form opens called form2. Form2 has a textfield with some text in it. When form2 opens I want the text in the text field to be highlighted. The text comes from a db. I know there a way of using SelLength and SelStart to achieve this. I dont know how! Thanks.
 
Got it thanks everyone.

Private Sub Text1_GotFocus()
Text1.SelStart = 0
Text1.SelLength = Len(Text1)
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top