TSmooth
July 27th, 2005, 07:39 AM
I am cloning a TreeNode which has it's tag set to a Class. After the clone, the Tag property is still set on the cloned treenode. However, when I place the treenode onto the clipboard and then get it back from the clipboard, the Tag property is "Nothing." How can I keep it set during a copy and paste? This is my first time working with the clipboard so let me know if any of this code is wrong. Here are the important lines I am using:
Dim newNode As TreeNode
' Clone the selected node
newNode = tvParentChild.SelectedNode.Clone() ' Tag property still set here on newNode.
Clipboard.SetDataObject(newNode)
Dim copiedNode As TreeNode
Dim iData As IDataObject
iData = Clipboard.GetDataObject()
copiedNode = CType(iData.GetData("System.Windows.Forms.TreeNode", False), TreeNode)
' copiedNode.Tag is now "Nothing"
If this is working as intended somehow, how can I keep the tag properties consistent?
Thanks for any help provided.
Dim newNode As TreeNode
' Clone the selected node
newNode = tvParentChild.SelectedNode.Clone() ' Tag property still set here on newNode.
Clipboard.SetDataObject(newNode)
Dim copiedNode As TreeNode
Dim iData As IDataObject
iData = Clipboard.GetDataObject()
copiedNode = CType(iData.GetData("System.Windows.Forms.TreeNode", False), TreeNode)
' copiedNode.Tag is now "Nothing"
If this is working as intended somehow, how can I keep the tag properties consistent?
Thanks for any help provided.