System.Windows.Forms.IDataObject.GetData Method

Retrieves the data associated with the specified data format, using a Boolean to determine whether to convert the data to the format.

Syntax

public object GetData (string format, bool autoConvert)

Parameters

format
The format of the data to retrieve. See System.Windows.Forms.DataFormats for predefined formats.
autoConvert
true to convert the data to the specified format; otherwise, false.

Returns

The data associated with the specified format, or null.

Remarks

If the autoConvert parameter is true and this method cannot find data in the specified format, it attempts to convert the data to the format. If the data cannot be converted to the specified format, or if the data was stored with the autoConvert parameter set to false, this method returns null.

If the autoConvert parameter is false, this method returns data in the specified format, or null if no data in this format can be found.

To determine whether data is associated with, or can be converted to, a format, call IDataObject.GetDataPresent(string, bool) before calling IDataObject.GetData(string, bool). Call IDataObject.GetFormats(bool) for a list of valid formats for the data stored in this instance.

Note:

Data can be converted to another format if it was stored specifying that conversion is allowed, and if the requested format is compatible with the stored format. For example, data stored as Unicode can be converted to text.

For an implementation of this method, see DataObject.GetData(string, bool).

Requirements

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