SetData Method

Applies To   See Also

Places data in the OLE drag-and-drop DataObject. Available at run time only.

Syntax

oDataObject.SetData(eData [, nFormat | cFormat])

Arguments

eData

Specifies the data placed on the DataObject. If you omit the optional nFormat and cFormat arguments, Visual FoxPro places the data on the DataObject in the CF_TEXT and CFSTR_OLEVARIANT formats. If eData is an array, precede eData with an ampersand (@). An array is placed on the DataObject in the CFSTR_OLEVARIANTARRAY format. An error is generated if eData is an object reference or a general field, or the array contains an object reference.

nFormat | cFormat

Specifies the format of the data placed on the DataObject. The following table lists the values for some common data formats with a description of each format. You can specify a user-defined format with cFormat. In this case, eData must be of character type or a binary type created with CREATEBINARY( ).

Data format* nFormat
| cFormat
Description
CF_TEXT 1 Text format.
CF_OEMTEXT 7 Text format containing characters in the OEM character set.
CF_UNICODETEXT 13 Unicode text format, available only under Windows NT.
CF_FILES or CF_HDROP 15 A handle that identifies a list of files, such as a set of files dragged from the Windows Explorer.
CFSTR_OLEVARIANTARRAY "OLE Variant Array" An array. Multiple values can be transferred in a single drag-and-drop operation with this format.

For example, this format can be used to drag a set of items in a list box to another list box.

CFSTR_OLEVARIANT "OLE Variant" A variant. All data types in Visual FoxPro are represented as variants. This format can be used to drag and drop Visual FoxPro data without losing the data type.
CFSTR_VFPSOURCEOBJECT "VFP Source Object" A reference to the Visual FoxPro drag source object.

* Defined in FOXPRO.H.

Remarks

The SetData method can only be executed in the OLEStartDrag event.