System.Windows.Forms.Clipboard.SetDataObject Method

Clears the Clipboard and then places nonpersistent data on it.

Syntax

public static void SetDataObject (object data)

Parameters

data
The data to place on the Clipboard.

Remarks

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 System.Runtime.InteropServices.ExternalException if all attempts are unsuccessful.

Note:

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 System.Windows.Forms.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.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0