IDataObject.SetData Method

DataObject.IDataObject.SetData Method (FORMATETC, STGMEDIUM, Boolean)


This API supports the product infrastructure and is not intended to be used directly from your code.

Transfers data to the object that implements this method. This method is called by an object that contains a data source.

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

[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
void IDataObject.SetData(
	ref FORMATETC pFormatetcIn,
	ref STGMEDIUM pmedium,
	bool fRelease


Type: System.Runtime.InteropServices.ComTypes.FORMATETC

A FORMATETC structure, passed by reference, that defines the format used by the data object when interpreting the data contained in the storage medium.

Type: System.Runtime.InteropServices.ComTypes.STGMEDIUM

A STGMEDIUM structure, passed by reference, that defines the storage medium in which the data is being passed.

Type: System.Boolean

true to specify that the data object called, which implements SetData, owns the storage medium after the call returns. This means that the data object must free the medium after it has been used by calling the ReleaseStgMedium function. false to specify that the caller retains ownership of the storage medium, and the data object called uses the storage medium for the duration of the call only.

Exception Condition

This method does not support the type of the underlying data object.

This member is an explicit interface member implementation. It can be used only when the DataObject is cast to an IDataObject interface.


for calling unmanaged code. Associated enumeration: SecurityPermissionFlag.UnmanagedCode

.NET Framework
Available since 2.0
Return to top
© 2015 Microsoft