SetData actually adds data

Incredibly, MSDN does not make it clear that the SetData method of IDataObject does not replace the data, but actually adds the data to the data object.

So, if you want multiple formats, just call SetData multiple times.

Update: The SetData method of the Clipboard class replaces the data. No wonder I’m so confused!

Posted by Ed Ball on July 18, 2008