How do I paste from the clipboard into a text box in VB6?
Posted on September 21st, 2008 in Programming |
I’ve the code which grants a user to click a commandbutton to duplicate or cut the selected text in a text box (using Clipboard.SetText), but I'm having problems getting the code “Clipboard.GetText” to work, as I can't define a target for the text to go. Can anybody help me write a piece of code which will paste the text where the cursor is when the button is clicked? (like in MS word and other word processors)
Answer:
Private Sub Copy_Click()
Clipboard.SetText Text1.Text
End Sub
Private Sub Paste_Click()
Text1.Text = Clipboard.GetText
End Sub
Answer:
txtBoxName.Text = Clipboard.GetText()