CodeItBetter Programming Another VB Programming Blog

How To select the entire contents of a TextBox control.

Posted on July 18, 2011
1
2
3
4
5
6
7
8
9
10
'Controls - How To select the entire contents of a TextBox control. 
'You often do it when the caret enters the field so that the user can quickly 
'override the existing value with a new one, or start editing it by pressing 
'any arrow key:

Private Sub Text1_GotFocus()
    Text1.SelStart = 0 
    ' A very high value always does the trick.
    Text1.SelLength = 9999
End Sub
Filed under: Controls Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.