Clipboard.SetDataObject Method (Object, Boolean, Int32, Int32)
Clears the Clipboard and then attempts to place data on it the specified number of times and with the specified delay between attempts, optionally leaving the data on the Clipboard after the application exits.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
'Declaration <UIPermissionAttribute(SecurityAction.Demand, Clipboard := UIPermissionClipboard.OwnClipboard)> _ Public Shared Sub SetDataObject ( _ data As Object, _ copy As Boolean, _ retryTimes As Integer, _ retryDelay As Integer _ )
- Type: System.Object
The data to place on the Clipboard.
- Type: System.Boolean
true if you want data to remain on the Clipboard after this application exits; otherwise, false.
- Type: System.Int32
The number of times to attempt placing the data on the Clipboard.
- Type: System.Int32
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 Nothing.
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 System.Runtime.Serialization for more information on serialization.
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