Share via


Overview | Methods | This Package | All Packages

OverviewMethodsThis PackageAll Packages

Clipboard.setDataObject

Sends data to the system Clipboard.

Syntax

public static void setDataObject( Object data )

public static void setDataObject( Object data**, boolean** copy**)**

Parameters

data

The data to place on the Clipboard.

copy

A boolean value that determines whether the data that is being sent to the Clipboard is copied or referenced.

Remarks

The setDataObject method allows you to assign data to the system Clipboard. If the second version of this method is called, and the copy value is set to true, the data being sent to the Clipboard is copied and persisted on the Clipboard when the application quits. If the value of copy is set to false, a reference to the data is placed on Clipboard.

The following example illustrates using the setDataObject method to store data on the Clipboard from selected text in an Edit control on a form.

private void mnuCopy_click(Object sender, Event e)
{
    //Send the currently selected text to the Clipboard
        Clipboard.setDataObject(edit1.getText());
}

See Also   IDataObject, DataObject, getDataObject