Gets a list of all formats that data stored in this instance is associated with or can be converted to.
[Visual Basic] Overloads Overridable Public Function GetFormats() As String () [C#] public virtual string[] GetFormats(); [C++] public: virtual String* GetFormats() []; [JScript] public function GetFormats() : String[];
An array of the names that represents a list of all formats that are supported by the data stored in this object.
Call this method to get the supported data formats before calling GetData. See DataFormats for the predefined formats.
Note Data can be converted to another format if it was stored specifying that conversion is allowed, and if the requested format is compatable with the stored format. For example, data stored as Unicode can be converted to text.
The following example queries a DataObject for the formats associated with its data, and the formats that the data can be converted to. The resulting list is displayed in a MessageBox. This code assumes Button1 has been instantiated.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) ' Create a new DataObject containing data associated with text format. Dim data1 As DataObject Set data1 = New DataObject(dataformats.Text, "My format test string") ' Query the DataObject for the data format and the data conversion formats. Dim arrayOfFormats() As String arrayofformats = data1.GetFormats() ' And display the results. Dim i As Integer Dim displayFormats As String displayFormats = "" For i = LBound(arrayOfFormats) To UBound(arrayOfFormats) displayFormats &= arrayOfFormats(i) & vbnewline Next MessageBox.Show "The format(s) associated with or that the data can be converted to are: " & displayFormats End Sub
DataObject Class | DataObject Members | System.WinForms Namespace | DataObject.GetFormats Overload List | GetData | SetData | DataFormats | GetDataPresent