DataObject::GetFormats Method ()
Returns a list of all formats that data stored in this DataObject is associated with or can be converted to.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Return Value
Type: array<System::String^>^An array of type String, containing a list of all formats that are supported by the data stored in this object.
Implements
IDataObject::GetFormats()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 compatible with the stored format. For example, data stored as Unicode can be converted to text. |
The following code 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 text box. This code requires that textBox1 has been created.
private: void GetAllFormats() { // Creates a new data object using a string and the text format. DataObject^ myDataObject = gcnew DataObject( DataFormats::Text,"Another string" ); // Gets all the data formats and data conversion formats in the DataObject. array<String^>^ arrayOfFormats = myDataObject->GetFormats(); // Prints the results. textBox1->Text = "The format(s) associated with the data are: \n"; for ( int i = 0; i < arrayOfFormats->Length; i++ ) { textBox1->Text = String::Concat( textBox1->Text, arrayOfFormats[ i ], "\n" ); } }
Available since 1.1
