Hello All,
I am implementing my own collection of nodes in a tree. I have read the topic Creating Your Own Collection Class: The House of Bricks in the Visual Basic Programmers Guide. I am using the ideas outlined in that chapter to implement my nodes collection. I have two classes:
Node
Nodes
The node class instantiates the objects that contain all of the properties and functions for each node in the tree. The nodes class is the collection class containing all of the nodes in a given tree.
Some of the properties for each node object include things like Parent, Child, Next, and Previous. In this way the structure of the entire tree is located in each of the node objects (they know where they are in the tree). Because of this, I have to have one node defined as the First (or Root, or Ultimate Parent) Node in the tree. The Nodes collection object has a property called FirstNode that returns a reference to the particular node that is actually the first node in the tree. The node objects, however, dont know if they are the first node or not that information is simply not stored. However, by definition, if a node has neither a Parent Node nor a Previous Node, it is the first Node in the tree. Because of this I have added an event to the Node class that gets raised whenever the Parent or Previous properties are changed in such a way as to convert that node into a First Node (whenever both properties become Null).
Here is my question: How do I catch this event from the Nodes collection class? At some point I have to declare a Node object with events, but I am not sure how to capture that event from any of 100 or more node objects that are contained within a collection inside of the Nodes class. Has anyone run across this type of situation before? Am I simply overlooking the obvious?
Thanks,
Lankford
sorry for the length of the question.
Start Free Trial