DataObject.SetText Method

Definition

Adds text data to the data object.

Overloads

SetText(String, TextDataFormat)

Adds text data to the data object in the format indicated by the specified TextDataFormat value.

SetText(String)

Adds text data to the data object in the UnicodeText format.

SetText(String, TextDataFormat)

Source:
DataObject.cs
Source:
DataObject.cs
Source:
DataObject.cs

Adds text data to the data object in the format indicated by the specified TextDataFormat value.

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

Parameters

textData
String

The text to add to the data object.

format
TextDataFormat

One of the TextDataFormat values.

Exceptions

textData is null or Empty.

format is not a valid TextDataFormat value.

Remarks

To retrieve text data from the data object, first use the ContainsText method to determine whether the data object contains image data before retrieving it with the GetText method.

See also

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 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

SetText(String)

Source:
DataObject.cs
Source:
DataObject.cs
Source:
DataObject.cs

Adds text data to the data object in the UnicodeText format.

C#
public virtual void SetText(string textData);

Parameters

textData
String

The text to add to the data object.

Exceptions

textData is null or Empty.

Remarks

To retrieve text data from the data object, first use the ContainsText method to determine whether the data object contains image data before retrieving it with the GetText method.

See also

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 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