Trucos de Visual Basic 6.0 Seleccionar texto en textbox


Con esta función seleccionaremos todo el texto de un textbox.


Public Sub TextSelected()
Dim i As Integer
Dim oMyTextBox As Object


Set oMyTextBox = Screen.ActiveControl
If TypeName(oMyTextBox) = "TextBox" Then
i = Len(oMyTextBox.Text)
oMyTextBox.SelStart = 0
oMyTextBox.SelLength = i
End If
End Sub


Simplemente añade la función a tu proyecto y llámala desde el evento GotFocus del TextBox.

Private Sub Text1_GotFocus()
TextSelected
End Sub

Comentarios sobre Seleccionar texto en textbox


santy dice:

buen ejercicio
Comentario publicado 18/01/2010 23:37:00
Dejar un comentario

Nombre:

Mail:

Web:

Comentario:

Trucos relacionados de Seleccionar texto en textbox