DataFormats.StringFormat Field


Specifies the Windows Forms string class format, which Windows Forms uses to store string objects. This static field is read-only.

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

public static readonly string StringFormat

Field Value

Type: System.String

This field is used by the IDataObject interface and the DataObject class to specify the data type.

When adding to an IDataObject or to an implementation of DataObject, use this field as the format for the IDataObject.SetData and DataObject.SetData methods.

To see if an object of this type exists, use this field as the format for the IDataObject.GetDataPresent and DataObject.GetDataPresent methods.

To get an object of this type, use this as the format for the IDataObject.GetData and DataObject.GetData methods.


The string class format is specific to Windows Forms only and will not be recognized by applications created outside of Windows Forms.

The following code example demonstrates the use of this member.

	String myString = "This is a String from the ClipBoard";
	// Sets the data to the Clipboard.   
	IDataObject myDataObject = Clipboard.GetDataObject();

	// Checks whether the data is present or not in the Clipboard.
		String clipString = (String)myDataObject.GetData(DataFormats.StringFormat);
		Console.WriteLine("No String information was contained in the clipboard.");
catch(Exception e)

.NET Framework
Available since 1.1
Return to top