Provides a format-independent mechanism for transferring data.

See Also: IDataObject Members


public interface IDataObject


The IDataObject interface is used by the System.Windows.Forms.Clipboard class and in drag-and-drop operations.

When implemented in a class, the System.Windows.Forms.IDataObject methods allow the user to store data in multiple formats in an instance of the class. Storing data in more than one format increases the chance that a target application, whose format requirements you might not know, can retrieve the stored data. To store data in an instance of System.Windows.Forms.IDataObject, call the IDataObject.SetData(string, bool, object) method and specify the data format in the format parameter. Set the autoConvert parameter to false if you do not want stored data to be converted to another format when it is retrieved. Invoke IDataObject.SetData(string, bool, object) multiple times on one instance of System.Windows.Forms.IDataObject to store data in more than one format.

You retrieve stored data from an System.Windows.Forms.IDataObject by calling the IDataObject.GetData(string, bool) method and specifying the data format in the format parameter. Set the autoConvert parameter to false to retrieve only data that was stored in the specified format. To convert the stored data to the specified format, set autoConvert to true, or do not use autoConvert.

To determine the formats of the data stored in an System.Windows.Forms.IDataObject, use the following System.Windows.Forms.IDataObject methods.

See the System.Windows.Forms.DataObject class for an implementation of this interface. See the System.Windows.Forms.DataFormats class for the predefined System.Windows.Forms.Clipboard data formats.


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