Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# clipboard direct copy paste

Tags:

c#

windows

Hi

I want to make direct copy/paste so for example I just make one click to button direct will make the paste to clipboard for this you can write example code

like image 697
fatin53 Avatar asked Apr 13 '12 12:04

fatin53


2 Answers

If you want to copy from a textbox (in this example textBox1), this is what you need:

Clipboard.SetText(textBox1.Text); //To copy your text to your clipboard
Clipboard.GetText(); //To get your text from your clipboard
like image 113
Rodrigue Rens Avatar answered Sep 29 '22 23:09

Rodrigue Rens


Use

Clipboard.SetText("your Text")

to Put Text to Clipboard

and

String myText = Clipboard.GetText()

to recieve Text from Your Keyboard.

like image 43
sebastianmehler Avatar answered Sep 30 '22 00:09

sebastianmehler