This documentation is archived and is not being maintained.

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

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

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.