[RESOLVED] Override TreeNode.Nodes.Add()
Hey all,
I have a class (myTreeNode) that inherits from TreeNode, and to myTreeNode I have added a class (customClass : IClonable) as a property.
When I add myTreeNode to a tree TreeView, the default customClass is used. When myTreeNode is added to another myTreeNode.Nodes collection, the childNode's customClass need to assume a clone of the parents customClass.
What I would like to do is override the Nodes.Add method from within the myTreenNode Class and clone the custom class there. I suppose I could override the entire Nodes collection and handle the Add, remove, etc methods, but all I need is to know when the child is added and have a reference to both the child and the parent at that time.
Any "easy" way to do this?
thanks for looking
Re: Override TreeNode.Nodes.Add()
sometimes all you have to do is ask to get the answer.
VB.Net Code:
Public Class MyTreeNode
Inherit Treenode
Public SUb AddNode(newNode as myTreeNode)
newNode.customClass = Me.customClass.Clone
me.Nodes.Add(newNode)
End Sub
End Class
Really isn't that difficult. Just took a little pie to get to.