Trucos de Visual Basic 6.0 Editor de texto


Mini editor de texto con funciones de seleccionar todo el texto, copiar texto, pegar texto...


Seleccionar todo el texto:
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)

Copiar texto:
Clipboard.Clear
Clipboard.SetText Text1.SelText
Text1.SetFocus

Pegar texto:
Text1.SelText = Clipboard.GetText()
Text1.SetFocus

Cortar texto:
Clipboard.SetText Text1.SelText
Text1.SelText = ""
Text1.SetFocus

Deshacer texto: (Nota: esta operación sólo es eficaz con el control Rich TextBox).

En un módulo copie esta línea:

Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal _
hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long

Esta es la instrucción de la función deshacer:

UndoResultado = SendMessage(Text1.hwnd, &HC7, 0&, 0&)
If UndoResultado = -1 Then
Beep
MsgBox "Error al intentar recuperar.", 20, "Deshacer texto"
End If


Seleccionar todo el texto:
SendKeys "^A"

Copiar texto:
SendKeys "^C"

Pegar texto:
SendKeys "^V"

Cortar texto:
SendKeys "^X"

Deshacer texto:
SendKeys "^Z"


Dejar un comentario

Nombre:

Mail:

Web:

Comentario:

Trucos relacionados de Editor de texto