Clipboard.SetDataObject Method (Object, Boolean)
Clears the Clipboard and then places data on it and specifies whether the data should remain after the application exits.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Data could not be placed on the Clipboard. This typically occurs when the Clipboard is being used by another process.
The current thread is not in single-threaded apartment (STA) mode. Add the STAThreadAttribute to your application's Main method.
The value of data is a null reference (Nothing in Visual Basic).
If the copy parameter is false, the data will be deleted from system Clipboard when the application exits.
This method attempts to set the data ten times in 100-millisecond intervals, and throws an ExternalException if all attempts are unsuccessful.
An object must be serializable for it to be put on the Clipboard. If you pass a non-serializable object to this method, it will fail without throwing an exception. See System.Runtime.Serialization for more information on serialization.
The following method is run in an application. It places a persistent copy of the selected text data in the text box on the system Clipboard. This code assumes button1, textBox1, and textBox2 have been created and placed on a form.
In a different application, the following method retrieves the text from the system Clipboard and pastes the text into textBox2. This code assumes button2 and textBox2 have been created and placed on a form.
for adding data to the system Clipboard that is of type String or is in one of the following data formats: Text, UnicodeText, or CommaSeparatedValue. Associated enumeration: UIPermissionClipboard.OwnClipboard
for adding data of any type or format to the system Clipboard. Associated enumeration: UIPermissionClipboard.AllClipboard
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.