Copiar, pegar y cortar lo que haya escrito en un Text Box

Iniciado por ANTRAX, Julio 26, 2010, 04:00:13 PM

Tema anterior - Siguiente tema

0 Miembros y 2 Visitantes están viendo este tema.

Para comenzar creamos un nuevo form y le metemos tres Commands Botonns y un Text Box.
Luego le cambiamos el texto a los botones por: Copiar, Pegar y Cortar y en el textbox escribimos cualquier cosa, yo en este caso voy a poner "Esto es un ejemplo de Copiar, Pegar y Cortar"


Bien, ahora vamos a escribir el código.
En el Command 1(el de Copiar) escribimos esto:

Código: php
Private Sub Command1_Click()
Clipboard.Clear
Clipboard.SetText Text1.SelText
Text1.SetFocus
End Sub


En Command 2(de Pegar):

Código: php
Private Sub Command2_Click()
Text1.SelText = Clipboard.GetText()
Text1.SetFocus
End Sub


Y en Command 3(de Cortar):

Código: php
Private Sub Command3_Click()
Clipboard.SetText Text1.SelText
Text1.SelText = ""
Text1.SetFocus
End Sub



Manual por: Darkwolf