Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

DataFormats.Format Class

Represents a clipboard format type.

For a list of all members of this type, see DataFormats.Format Members.

System.Object
   System.Windows.Forms.DataFormats.Format

[Visual Basic]
Public Class DataFormats.Format
[C#]
public class DataFormats.Format
[C++]
public __gc class DataFormats.Format
[JScript]
public class DataFormats.Format

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Remarks

A format type consists of a text-based format name and an ID number. The format name/ID number pair can define a system Clipboard or other format.

Example

[Visual Basic, C#, C++] The following example shows how to retrieve a DataFormats.Format representing a format name/ID pair. The UnicodeText format is requested, and the contents of the retrieved DataFormats.Format object are displayed in a text box.

[Visual Basic, C#, C++] This code assumes textBox1 has been created.

[Visual Basic] 
Private Sub GetMyFormatInfomation()
    ' Creates a DataFormats.Format for the Unicode data format.
    Dim myFormat As DataFormats.Format = _
       DataFormats.GetFormat(DataFormats.UnicodeText)
       
    ' Displays the contents of myFormat.
    textBox1.Text = "ID value: " + myFormat.Id.ToString() + ControlChars.Cr _
                  + "Format name: " + myFormat.Name
End Sub


[C#] 
private void GetMyFormatInfomation() {
   // Creates a DataFormats.Format for the Unicode data format.
   DataFormats.Format myFormat = DataFormats.GetFormat(DataFormats.UnicodeText);

   // Displays the contents of myFormat.
   textBox1.Text = "ID value: " + myFormat.Id + '\n' +
      "Format name: " + myFormat.Name;
}


[C++] 
private:
 void GetMyFormatInfomation() {
    // Creates a DataFormats.Format for the Unicode data format.
    DataFormats::Format* myFormat = DataFormats::GetFormat(DataFormats::UnicodeText);
 
    // Displays the contents of myFormat.
    textBox1->Text = String::Format( S"ID value: {0}\nFormat name: {1}", __box(myFormat->Id), myFormat->Name );
 }
 

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.Windows.Forms

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

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

See Also

DataFormats.Format Members | System.Windows.Forms Namespace | Clipboard | DataFormats | DataObject | IDataObject

Show:
© 2014 Microsoft. All rights reserved.