DataObject.SetData DataObject.SetData DataObject.SetData DataObject.SetData Method

Definition

Stores the specified data in this data object.

Overloads

SetData(Object) SetData(Object) SetData(Object) SetData(Object)

Stores the specified data in this data object, automatically determining the data format from the source object type.

SetData(String, Object) SetData(String, Object) SetData(String, Object) SetData(String, Object)

Stores the specified data in this data object, along with one or more specified data formats; the data format is specified by a string.

SetData(Type, Object) SetData(Type, Object) SetData(Type, Object) SetData(Type, Object)

Stores the specified data in this data object, along with one or more specified data formats; the data format is specified by a Type object.

SetData(String, Object, Boolean) SetData(String, Object, Boolean) SetData(String, Object, Boolean) SetData(String, Object, Boolean)

Stores the specified data in this data object, along with one or more specified data formats. This overload includes a Boolean flag to indicate whether the data can be converted to another format on retrieval.

SetData(Object) SetData(Object) SetData(Object) SetData(Object)

Stores the specified data in this data object, automatically determining the data format from the source object type.

public:
 virtual void SetData(System::Object ^ data);
[System.Security.SecurityCritical]
public void SetData (object data);
abstract member SetData : obj -> unit
override this.SetData : obj -> unit
Public Sub SetData (data As Object)

Parameters

data
Object Object Object Object

An object that represents the data to store in this data object.

Implements

Exceptions

Remarks

This method adds data with auto-conversion enabled (the same as calling SetData(String, Object, Boolean) with autoConvert set to true).

Security

UIPermission
for permission to transfer data to the system Clipboard. Associated enumeration: **AllClipboard**.

SetData(String, Object) SetData(String, Object) SetData(String, Object) SetData(String, Object)

Stores the specified data in this data object, along with one or more specified data formats; the data format is specified by a string.

public:
 virtual void SetData(System::String ^ format, System::Object ^ data);
[System.Security.SecurityCritical]
public void SetData (string format, object data);
abstract member SetData : string * obj -> unit
override this.SetData : string * obj -> unit
Public Sub SetData (format As String, data As Object)

Parameters

format
String String String String

A string that specifies the format for the data. For a set of predefined data formats, see the DataFormats class.

data
Object Object Object Object

An object that represents the data to store in this data object.

Implements

Exceptions

Remarks

This method adds data with auto-conversion enabled (the same as calling SetData(String, Object, Boolean) with autoConvert set to true).

Security

UIPermission
for permission to transfer data to the system Clipboard. Associated enumeration: **AllClipboard**.

SetData(Type, Object) SetData(Type, Object) SetData(Type, Object) SetData(Type, Object)

Stores the specified data in this data object, along with one or more specified data formats; the data format is specified by a Type object.

public:
 virtual void SetData(Type ^ format, System::Object ^ data);
[System.Security.SecurityCritical]
public void SetData (Type format, object data);
abstract member SetData : Type * obj -> unit
override this.SetData : Type * obj -> unit
Public Sub SetData (format As Type, data As Object)

Parameters

format
Type Type Type Type

A Type object that specifies the format for the data. For a set of predefined data formats, see the DataFormats class.

data
Object Object Object Object

An object that represents the data to store in this data object.

Implements

Exceptions

Remarks

This method adds data with auto-conversion enabled (the same as calling SetData(String, Object, Boolean) with autoConvert set to true).

Security

UIPermission
for permission to transfer data to the system Clipboard. Associated enumeration: **AllClipboard**.

SetData(String, Object, Boolean) SetData(String, Object, Boolean) SetData(String, Object, Boolean) SetData(String, Object, Boolean)

Stores the specified data in this data object, along with one or more specified data formats. This overload includes a Boolean flag to indicate whether the data can be converted to another format on retrieval.

public:
 virtual void SetData(System::String ^ format, System::Object ^ data, bool autoConvert);
[System.Security.SecurityCritical]
public void SetData (string format, object data, bool autoConvert);
abstract member SetData : string * obj * bool -> unit
override this.SetData : string * obj * bool -> unit
Public Sub SetData (format As String, data As Object, autoConvert As Boolean)

Parameters

format
String String String String

A string that specifies the format for the data. For a set of predefined data formats, see the DataFormats class.

data
Object Object Object Object

An object that represents the data to store in this data object.

autoConvert
Boolean Boolean Boolean Boolean

true to allow the data to be converted to another format on retrieval; false to prohibit the data from being converted to another format on retrieval.

Implements

Exceptions

Security

UIPermission
for permission to transfer data to the system Clipboard. Associated enumeration: **AllClipboard**.

Applies to