by Jerry Tilsley (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 3rd April 2002
Date Added: Mon 8th February 2021
Rating:
(1 Votes)
Highlights the text in any textbox that receives focus!
'function to see the magic work. Examples are listed later in this code.
Public Function txtGotFocus()
For i = 0 To Form1.Count - 1
Set obj = Form1.ActiveControl
If TypeOf obj Is TextBox Then
obj.SelStart = 0
obj.SelLength = Len(obj.Text)
End If
Next i
End Function
'This demostrates the use of TextBox arrays
Private Sub Text1_GotFocus(Index As Integer)
txtGotFocus
End Sub
'This demostrates the use of just normal multiple TextBoxes
'Just attach the "txtGotFocus" command to any textbox GotFocus event.
Private Sub Text2_GotFocus()
txtGotFocus
End Sub