How to highlight textbox.text?

cesarfrancisco

Active member
Joined
Apr 3, 2007
Messages
33
Programming Experience
Beginner
This feature is implemented in almost all application with textboxes.
If the user returns via a mouse selection into a textbox, the textbox.text is highlighted - ready for editing.
Is this possible in VB?
 
You are probably interesting in anything of Textbox related to "Select..." like properties SelectedText, SelectionStart, SelectionLength, HideSelection and methods Select and SelectAll.
 
Solution (or at least one solution):

VB.NET:
Private Sub txtboxMS_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles txtboxMS.MouseClick, txtboxFN.MouseClick, txtboxLN.MouseClick, txtboxDOB.MouseClick
        Dim numBox As TextBox = CType(sender, TextBox)
        numBox.SelectAll()
        numBox.Focus()
End Sub
 
Last edited by a moderator:
Back
Top