fatin53
fatin53

Reputation: 91

C# clipboard direct copy paste

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

Upvotes: 8

Views: 34142

Answers (3)

sebastianmehler
sebastianmehler

Reputation: 1033

For Listbox:

myListbox.Items.Add(Clipboard.GetText());

Upvotes: 0

Rodrigue Rens
Rodrigue Rens

Reputation: 287

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

Upvotes: 13

sebastianmehler
sebastianmehler

Reputation: 1033

Use

Clipboard.SetText("your Text")

to Put Text to Clipboard

and

String myText = Clipboard.GetText()

to recieve Text from Your Keyboard.

Upvotes: 2

Related Questions