How could i make it so when i tab between text boxes,which ever textbox has focus makes it highlight the text
Printable View
How could i make it so when i tab between text boxes,which ever textbox has focus makes it highlight the text
VB Code:
Private Sub Text1_GotFocus() Text1.SelStart = 0 Text1.SelLength = Len(Text1.Text) End Sub
just a tip: this is the way i use it...
VB Code:
'in a module... Sub HiLite(myText as TextBox) myText.SelStart = 0 myText.SelLength = Len(myText.Text) End Sub 'then call it in a TextBox's GotFocus event: Private Sub Text1_GotFocus() HiLite Text1 End Sub
this is helpful when you're dealing with multiple textboxes... ;)
or better use control array so you are going to call the gotfocus event only once for al the textboxes.