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 );
Exception Type | Condition |
---|---|
Exception | Data could not be placed on the Clipboard. The exception can occur because another application has the Clipboard open. |
Data will be deleted from system Clipboard when the application exits.
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
Clipboard Class | Clipboard Members | System.WinForms Namespace | Clipboard.SetDataObject Overload List | DataObject | DataFormats | IDataObject | GetDataObject