Assembly: System.Windows.Forms (in system.windows.forms.dll)
The format of the data to set. See DataFormats for predefined formats.
An Object representing the data to add.
The Clipboard could not be cleared. 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.
data is a null reference (Nothing in Visual Basic).
If you do not know the format of the target application, you can store data in multiple formats using this method.
Data stored using this method can be converted to a compatible format when it is retrieved.
To retrieve data from the Clipboard in a particular format, first use the ContainsData method to determine whether the Clipboard contains data in that format before retrieving it with the GetData method.
The Clipboard class can only be used in threads set to single thread apartment (STA) mode. To use this class, ensure that your Main method is marked with the STAThreadAttribute attribute.
The following example demonstrates this member.
- UIPermission 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
- UIPermission for adding data of any type or format to the system Clipboard. Associated enumeration: UIPermissionClipboard.AllClipboard
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.