954,582 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Text Box Newbie help

How do I get my text boxes to automatically highlight the default text so users can start typing without having to delete or highlight it themselves?

Lunaticrr
Light Poster
27 posts since May 2005
Reputation Points: 10
Solved Threads: 0
 

Hi
To select text in a textbox control, you just need to specify the start and length of the selection, in characters. Paste this code into the form.load event handler, or wherever you want it..

'set selection start to char 0
Text1.SelStart = 0
'set selection length to the length of whatever's in the text box
Text1.SelLength = Len(Text1.Text)


Hope this helps
Alan

AlanC
Light Poster
31 posts since Jul 2005
Reputation Points: 13
Solved Threads: 1
 

Thanks alot. That works nicely. :D

Lunaticrr
Light Poster
27 posts since May 2005
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You