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)

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

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

.NET Framework

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

.NET Compact Framework

Supported in: 3.5, 2.0