DataObject.SetText Method

Definition

Stores text data, specified as a string, in this data object.

Overloads

SetText(String)

Stores UnicodeText data, specified as a string, in this data object.

SetText(String, TextDataFormat)

Stores text data in this data object. The format of the text data to store is specified with a member of TextDataFormat.

SetText(String)

Stores UnicodeText data, specified as a string, in this data object.

C#
public void SetText(string textData);

Parameters

textData
String

A string that contains the UnicodeText data to store in the data object.

Exceptions

textData is null.

Remarks

This data format denotes 16-bit character encoded Unicode, also referred to as UTF-16, and USC-2.

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

See also

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

SetText(String, TextDataFormat)

Stores text data in this data object. The format of the text data to store is specified with a member of TextDataFormat.

C#
public void SetText(string textData, System.Windows.TextDataFormat format);

Parameters

textData
String

A string that contains the text data to store in the data object.

format
TextDataFormat

A member of TextDataFormat that specifies the text data format to store.

Exceptions

textData is null.

Remarks

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

See also

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10