Programación General > Visual Basic 6.0 e inferiores

 Re: copiar, cortar y pegar

(1/1)

gabperez:
voy mejorando. Ahora tengo problemas con copiar, cortar y pegar.
El siguiente código me selecciona bien el texto, pero me da error al querer copiar o cortar: Ayuda please!!!

Private Sub mnuCopiar_Click()
Clipboard.Clear
Clipboard.SelText: text1.SelText
text1.SetFocus
End Sub

Private Sub mnuCortar_Click()
Clipboard.SelText: text1.SelText
text1.SelText = ""
text1.SetFocus
End Sub

Private Sub mnuPegar_Click()
text1.SelText = Clipboard.GetText()
text1.SetFocus
End Sub

cpmario:
Usa este código, puedes copiar, cortar y pegar desde cualquier control de tipo TextBox:

Private Sub mnuCopiar_Click()
Clipboard.Clear
Clipboard.SetText ActiveControl.SelText
End Sub

Private Sub mnuCortar_Click()
Clipboard.SetText ActiveControl.SelText
ActiveControl.SelText = ""
End Sub

Private Sub mnuPegar_Click()
ActiveControl.SelText = Clipboard.GetText(vbCFText)
End Sub

Navegación

[0] Índice de Mensajes

Ir a la versión completa