S
Steffen
hi,
there's some very strange with the clipboard (I'm using .NET 2.0). I
tried to set an object (type is inherited from TreeNode) to the
clipboard. This works fine but when I want to retrieve this object from
clipboard it doesn't work. It's strange because the GetDataPresent
methode returns "true" when I ask wether the requested type of object
is present at the clipboard. However getting the object returns "null".
Here's some code of my app:
// copy to clipboard
TreeNodeEx copy = (TreeNodeEx)treeCards.SelectedNode.Clone();
DataObject data = new DataObject();
data.SetData("Test", copy);
Clipboard.SetDataObject(data);
// paste from clipboard
TreeNodeEx t = Clipboard.GetDataObject().GetData("Test") as TreeNodeEx;
// type of the object
[Serializable]
class TreeNodeEx : TreeNode
{
[...]
}
Why doesn't this work?
Thanks for any help
Steffen
there's some very strange with the clipboard (I'm using .NET 2.0). I
tried to set an object (type is inherited from TreeNode) to the
clipboard. This works fine but when I want to retrieve this object from
clipboard it doesn't work. It's strange because the GetDataPresent
methode returns "true" when I ask wether the requested type of object
is present at the clipboard. However getting the object returns "null".
Here's some code of my app:
// copy to clipboard
TreeNodeEx copy = (TreeNodeEx)treeCards.SelectedNode.Clone();
DataObject data = new DataObject();
data.SetData("Test", copy);
Clipboard.SetDataObject(data);
// paste from clipboard
TreeNodeEx t = Clipboard.GetDataObject().GetData("Test") as TreeNodeEx;
// type of the object
[Serializable]
class TreeNodeEx : TreeNode
{
[...]
}
Why doesn't this work?
Thanks for any help
Steffen