System.Windows.Forms.Clipboard.GetDataObject Method

Retrieves the data that is currently on the system Clipboard.

Syntax

public static IDataObject GetDataObject ()

Returns

An System.Windows.Forms.IDataObject that represents the data currently on the Clipboard, or null if there is no data on the Clipboard.

Remarks

Because the data type of the object returned from the Clipboard can vary, this method returns the data in an System.Windows.Forms.IDataObject. Then you can use methods of the System.Windows.Forms.IDataObject interface to extract the data in its proper data type.

This method attempts to get the data ten times in 100-millisecond intervals, and throws an System.Runtime.InteropServices.ExternalException if all attempts are unsuccessful.

Note:

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