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!

Clipboard.SetDataObject (Object)

Places nonpersistent data on the system Clipboard.

[Visual Basic]
Overloads Public Shared Sub SetDataObject( _
   ByVal data As Object _
)
[C#]
public static void SetDataObject(
   object data
);
[C++]
public: static void SetDataObject(
   Object* data
);
[JScript]
public static function SetDataObject(
   data : Object
);

Parameters

data
The data to place on the Clipboard.

Exceptions

Exception Type Condition
Exception Data could not be placed on the Clipboard. The exception can occur because another application has the Clipboard open.

Remarks

Data will be deleted from system Clipboard when the application exits.

Example [Visual Basic]

The following example uses SetDataObject to place nonpersistent text data onto the system Clipboard. This code assumes Button1 and TextBox1 have been instantiated.

[Visual Basic]

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
   'Take the selected text from a text box and put it on the clipboard.
   Clipboard.SetDataObject(TextBox1.SelectedText)
End Sub

See Also

Clipboard Class | Clipboard Members | System.WinForms Namespace | Clipboard.SetDataObject Overload List | DataObject | DataFormats | IDataObject | GetDataObject