tags:

views:

55

answers:

2

if i have a string, e.g "hello", how can i do in c# that it will be copy to the clipboard, so next time i'll do ctrl+v i'll get "hello"?

+3  A: 

First google result for 'clipboard C#':

http://www.geekpedia.com/tutorial188_Clipboard-Copy-and-Paste-with-Csharp.html

First line of code in said article:

Clipboard.SetText(txtClipboard.Text);
Kieren Johnstone
beat me to it! +1 The Clipboard class is in `System.Windows.Forms`
Matt Ellen
i added the namespace, but i still don't see the Clipboard class. maybe it's because i am usintg console application?
yes it is! tanks!
+1  A: 
Clipboard.SetText("hello");

You'll need to use the System.Windows.Forms or System.Windows namespaces for that.

Bradley Smith