NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

DataFormats.GetFormat (String)

Gets a DataFormats.Format with the Windows Clipboard numeric ID and name for the specified format.

[Visual Basic]
Overloads Public Shared Function GetFormat( _
   ByVal format As String _
) As Format
[C#]
public static Format GetFormat(
   string format
);
[C++]
public: static Format* GetFormat(
   String* format
);
[JScript]
public static function GetFormat(
   format : String
) : Format;

Parameters

format
The format name.

Return Value

A DataFormats.Format that has the Windows Clipboard numeric ID and the name of the format.

Exceptions

Exception Type Condition
Exception Registering a new Clipboard format failed.

Remarks

Call GetFormat with the format name when you need a Windows Clipboard numeric ID for an existing format.

Call this method with your own format name to create a new Clipboard format type. If the specified format does not exist, this method will register the name as a Clipboard format with the Windows Registry and get a unique format identifier. This new name/ID pair will be added to the static (in Visual Basic Shared) list of format name/ID pairs in the DataFormats class.

Example [Visual Basic]

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 MessageBox. This code assumes Button1 has been instantiated.

[Visual Basic]

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
   ' Get a DataFormat.Format for unicode data format.
   Dim formatObj1 As DataFormats.Format
   Set formatObj1 = DataFormats.GetFormat(DataFormats.UnicodeText)

   ' Display contents of the DataFormats.Format.
   messagebox.Show "Id value: " & formatobj1.id & vbnewline & _
      "Format name: " & formatobj1.name & vbnewline & _
      "Windows handle needed?: " & formatObj1.win32Handle
End Sub

See Also

DataFormats Class | DataFormats Members | System.WinForms Namespace | DataFormats.GetFormat Overload List | DataFormats.Format