This topic has not yet been rated - Rate this topic

IDataObject.SetData Method (String, Boolean, Object)

Stores the specified data and its associated format in this instance, using a Boolean value to specify whether the data can be converted to another format.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)
abstract SetData : 
        format:string * 
        autoConvert:bool * 
        data:Object -> unit

Parameters

format
Type: System.String

The format associated with the data. See DataFormats for predefined formats.

autoConvert
Type: System.Boolean

true to allow the data to be converted to another format; otherwise, false.

data
Type: System.Object

The data to store.

If you do not know the format of the target application, you can store data in multiple formats using this method.

For an implementation of this method, see DataObject.SetData.

This example uses the DataObject class, which implements IDataObject, to demonstrate the use of the SetData method. First, it creates a data object (myDataObject) and stores a UnicodeText string in it, with the autoConvert parameter set to false. Then it retrieves the format(s) associated with the data stored in the object and displays the result in a message box. The only format associated with the data is the UnicodeText format. This example assumes that you have created a Form named Form1.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.