Highlight entire textbox entry
By: Dale Botwin Date: 13/10/1998

Sometimes you want to put a default text in a textbox. If the user wants do replace it with a new entry, you can help him by highlighting the entire entry of the textbox. When he'll start writing, the entry will be replaced. This is present in many Windows applications and this is also used to replace data the user entered incorrectly.

textbox.SelStart = 0
textbox.SelLength = Len(textbox.Text)

textbox is the name of the textbox.
The property
SelStart sets the starting point for the selection. We simply use the SelLength property to extend the selection over all the text.

Click Here!

Visual Basic Programming Zone is a website by Lorenzo Dalla Vecchia.
To contact the Webmaster, click here.
Hosted by InWind: www.inwind.it