Clipboard.SetDataObject Method (Object, Boolean, Int32, Int32)
Assembly: System.Windows.Forms (in system.windows.forms.dll)
public static void SetDataObject ( Object data, bool copy, int retryTimes, int retryDelay )
public static void SetDataObject ( Object data, boolean copy, int retryTimes, int retryDelay )
public static function SetDataObject ( data : Object, copy : boolean, retryTimes : int, retryDelay : int )
The data to place on the Clipboard.
true if you want data to remain on the Clipboard after this application exits; otherwise, false.
The number of times to attempt placing the data on the Clipboard.
The number of milliseconds to pause between attempts.
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).
retryTimes is less than zero.
retryDelay is less than zero.
Data could not be placed on the Clipboard. This typically occurs when the Clipboard is being used by another process.
Adding data to the Clipboard can occasionally fail if the Clipboard is busy with another thread or application. This method is useful to work around this issue in environments with heavy Clipboard use.
If the copy parameter is false, the data will be deleted from system Clipboard when the application exits.
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 Serialization for more information on serialization.
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.
- 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 Server 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 EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.