Initializes a new instance of the DataObject class.
Initializes a new instance of the DataObject class, with the specified data.
[Visual Basic] Overloads Public Sub New(IDataObject)
[C#] public DataObject(IDataObject);
[C++] public: DataObject(IDataObject*);
[JScript] public function DataObject(IDataObject);
Initializes a new instance of the DataObject class, containing the specified Microsoft.Win32.Interop.IOleDataObject.
[Visual Basic] Overloads Public Sub New(IOleDataObject)
[C#] public DataObject(IOleDataObject);
[C++] public: DataObject(IOleDataObject*);
[JScript] public function DataObject(IOleDataObject);
Initializes a new instance of the DataObject class, which can store arbitrary data.
[Visual Basic] Overloads Public Sub New()
[C#] public DataObject();
[C++] public: DataObject();
[JScript] public function DataObject();
Initializes a new instance of the DataObject class, containing the specified data.
[Visual Basic] Overloads Public Sub New(Object)
[C#] public DataObject(Object);
[C++] public: DataObject(Object*);
[JScript] public function DataObject(Object);
Initializes a new instance of the DataObject class, containing the specified data and its associated format.
[Visual Basic] Overloads Public Sub New(String, Object)
[C#] public DataObject(String, Object);
[C++] public: DataObject(String*, Object);
[JScript] public function DataObject(String, Object);
The following example creates an instance of the DataObject class using a string that is specified as text format. The data is retrieved from the instance by specifying its format as text. Then the data is displayed in a text box. This code assumes Button1 and TextBox1 have been instantiated.
Note This example shows how to use one of the overloaded version of the DataObject constructor. For other examples that may be available, see the individual overload topics.
[C#]
private void CreateDataObject() { //Create a new data object using a string. string myString = "My text string"; DataObject myDataObject = new DataObject(DataFormats.Text, myString); //Print the string in a text box. textBox1.Text = myDataObject.GetData(DataFormats.Text).ToString(); }
DataObject Class | DataObject Members | System.WinForms Namespace