wencha
wencha

Reputation: 157

Copy to clipboard without System.Windows.Forms.Clipboard?

Well the question is that. Is there anyway to copy text and/or files to the Windows clipboard WITHOUT using Clipboard Class from .NET?

Upvotes: 3

Views: 5354

Answers (1)

therealmitchconnors
therealmitchconnors

Reputation: 2760

Depends on if I am answering the question in the title or in the text... you can access System.Windows.Clipboard without having access to System.Windows.Forms...

string textData = "I want to put this string on the clipboard.";

// After this call, the data (string) is placed on the clipboard and tagged
// with a data format of "Text".
System.Windows.Clipboard.SetData(DataFormats.Text, (Object)textData);

Upvotes: 5

Related Questions