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, Boolean)

Places data on the system Clipboard. using copy to specify whether the data should remain on the Clipboard after the application exits.

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

Parameters

data
The data to place on the Clipboard.
copy
true if you want data to remain on the Clipboard after this application exits; otherwise, false.

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

When the copy parameter is true, the data will remain on the Clipboard after the application has exited.

When copy is false, the data will be deleted from system Clipboard when the application exits.

Example [Visual Basic]

The following example places a persistent copy of the selected text data in the text box on the system Clipboard. This code assumes Button3 and TextBox1 have been instantiated.

[Visual Basic]

Private Sub Button3_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, True)
End Sub

See Also

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