Export (0) Print
Expand All

IDataObject Interface

Provides a format-independent mechanism for transferring data.

For a list of all members of this type, see IDataObject Members.

[Visual Basic]
<ComVisible(True)>
Public Interface IDataObject
[C#]
[ComVisible(true)]
public interface IDataObject
[C++]
[ComVisible(true)]
public __gc __interface IDataObject
[JScript]
public
   ComVisible(true)
interface IDataObject

Classes that Implement IDataObject

Class Description
DataObject Implements a basic data transfer mechanism.

Remarks

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

When implemented in a class, the 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 IDataObject, call the SetData 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 SetData multiple times on one instance of IDataObject to store data in more than one format.

You retrieve stored data from an IDataObject by calling the GetData 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 IDataObject, use the following IDataObject methods.

  • Call the GetFormats method to retrieve an array of all the formats in which the data is available. Set the autoConvert parameter to false to get only the formats in which the data is stored. To get all the formats in which the data is available, set autoConvert to true, or do not use this parameter.
  • Call the GetDataPresent method to determine whether stored data is available in a certain format. If you do not want stored data to be converted to the specified format, set the autoConvert parameter to false.

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

Requirements

Namespace: System.Windows.Forms

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System.Windows.Forms (in System.Windows.Forms.dll)

See Also

IDataObject Members | System.Windows.Forms Namespace | DataObject | DataFormats

Show:
© 2014 Microsoft