Wednesday, December 17, 2008

[vb6] Autoselect text in textboxes

In some applications, you see textboxes where the entire text is automatically selected when the box obtains focus (The Address box in MS Internet Explorer, for example). You can get the same functionality with a VB textbox by using this code:
    Private Sub Text1_GotFocus()
Text1.SelStart = 0
Text1.SelLength = Len(Text1)
End Sub

No comments:

Post a Comment