Reputation: 7480
I know this is asked many times before but it s not what i look for, to make copy paste in c# we use;
//Copy
Clipboard.SetDataObject("String to copy");
//Paste
IDataObject iData = Clipboard.GetDataObject();
I only want to use copy, after using:
Clipboard.SetDataObject("String to copy");
when i close the program, then when i right click and paste on a txt file nothing happens!
So Clipboard class seems doesnt help, so i need another solution.
Upvotes: 3
Views: 3453
Reputation: 9027
Clipboard.SetDataObject("String to copy", true);
That boolean value at the end specifies whether the string should remain in the clipboard after the application closes, and is set to false as default.
Upvotes: 6
Reputation: 31474
You want to use second overload of SetDataObject(object, bool).
When bool
is set to true
, data will remain after application is closed.
Upvotes: 3
Reputation: 57593
Did you try to use Clipboard.SetText(your_String)
?
This works for me.
Upvotes: 1