![]() |
| | #1 |
| Registered User Join Date: Sep 2004
Posts: 3
| Clipboard and Custom Types I've been trying like crazy to figure out how to copy an object of a custom type to the Clipboard via Clipboard.SetDataObject() and then retrieve it with Clipboard.GetDataObject(). I've tried everything I can think of. I declare a DataObject, made out of my custom object, and give it a format name, and send it to the clipboard. Then I bring it back from the clipboard, as an IDataObject, use GetDataPresent(*format name", true), and it says that the data is present. But when I use GetData, it returns null! What is going on here? There are many demos about how to use the clipboard with strings and bitmaps but that's pretty useless. What's the point of C#'s clipboard support if all you can do is transfer bitmaps? I can post code if anyone is interested. |
| McClamm is offline | |
| | #2 |
| Registered User Join Date: Aug 2002
Posts: 1,330
| If you want to use custom objects with the managed clipboard functions, the object must be declared as [Serializable()]. Code: [Serializable()]
public class CustomData
{
... blah blah blah ...
}
|
| BMJ is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|