问题
This question is about having a button and text box. And when you click the button, the text in the text box highlights and is copied to your clipboard it one quick move. I'm building this code in VB (Microsoft, Visual Basic 2010).
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
[...]
End Sub
Awaiting the answer. Thanks.
回答1:
Try this:
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Clipboard.SetText(Me.TextBox1.Text, TextDataFormat.Text)
End Sub
来源:https://stackoverflow.com/questions/9117087/how-can-i-click-a-button-in-vb-and-highlight-a-text-box-and-copies-conent-to-cli