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!

DataObject Constructor ()

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();

Remarks

The new instance provides both the IDataObject and the Microsoft.Win32.Interop.IOleDataObject interfaces.

Example [C#]

The following example creates an instance of the DataObject class, and adds data to the instance. Then it retrieves and displays the data. This code assumes Button1 and TextBox1 have been instantiated.

[C#]

private void CreateDataObject2() {
   //Create a new data object.
   DataObject myDataObject = new DataObject();

   //Add the string to the data object.
   string myString = "My text string";
   myDataObject.SetData(DataFormats.UnicodeText, myString);

   //Print the string in a text box.
   textBox1.Text = myDataObject.GetData(DataFormats.Text).ToString();
}

See Also

DataObject Class | DataObject Members | System.WinForms Namespace | DataObject Constructor Overload List | GetData | SetData | GetDataPresent