Using Clipboard to Copy and Paste Text

To Copy the Text on the Clipboard the code would be..

String sourceText = "Some Text";

Clipboard.SetDataObject(sourceText, true);

To Set the Text from the Clipboard the code would be..

string destinationText;

if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Text))

destinationText = Clipboard.GetDataObject().GetData(DataFormats.Text).ToString();

else

destinationText = "The clipboad does not contain any text";


Submitted By Nipesh Shah @ 10/5/2011 11:46:32 AM

Search This Blog

Link Within Related Posts Plugin for WordPress, Blogger...