Share via


Overview | Methods | This Package | All Packages

OverviewMethodsThis PackageAll Packages

Clipboard.getDataObject

Retrieves any data that is currently on the Clipboard.

Syntax

public static IDataObject getDataObject()

Return Value

Returns an object that implements the IDataObject class representing the data retrieved from the Clipboard.

Remarks

Because the data type of the object returned from the Clipboard can vary, you must use an IDataObject object to store the retrieved data. Once the data has been stored in the object, you can use methods from the IDataObject class to extract the data to its proper data type.

The following code illustrates how to use the getDataObject method to retrieve data that is currently on the Clipboard. It also shows how to use the methods of the IDataObject class to assign an Edit control's text with the contents of the IDataObject.

    private void mnuPaste_click(Object sender, Event e) {
            IDataObject d = Clipboard.getDataObject();
            if (d.isDataPresent(String.class) {
                edit1.setText((String)d.getData(String.class));
            }
    }

See Also DataObject, setDataObject