Hi, I have a few classes that should report stuff to a TreeView. Some of the classes are single instanced and other multiple. So, for the single instanced classes I'll have just one root node to store its info, and for the multiple instanced, I want to have a root node for the class category and then multiple nodes as new instances get created. Something like:

Dog (single)
- info for dog
Cats (multiple)
- Cat1
-- info for cat 1
- Cat 2
-- info for cat 2

The Nodes hierarchy is given by a string[] containing all the names. So, string[0] would be the root node, string[1] would be a child of string[0], string[2] would be a child of string[1], etc.

I'm having a hard time creating the nodes and then finding them when I have to add something to one of them.
When adding, I want to check if there is an existing one already, and only add if not.
string[] treeNames = { "House 1", "Dogs", "Fluffy" }

if (treeview doesn't have a node "House 1")
   add it;

if (now new or already existing node "House 1" doesn't have a node "Dogs")
   add it;

if (now new or already node "Dogs" doesn't have a node "Fluffy")
   add it;
it all would point to a foreach loop with the string[], but I can't seem to find an easy way of getting a reference to the newly created nodes to add subnodes to them.
I tried this, and it adds the root nodes, but not the child nodes.
string rootNodeName = treeNames[0];
TreeNode newNode, lastAddedNode = null;

foreach (string branch in treeNames)
	newNode = new TreeNode(branch);

	if (lastAddedNode == null)
		// Root Node, added to the TreeView
		TreeNode[] existingNodes = this.tvDebugInformation.Nodes.Find(branch, false);
		if (existingNodes.GetLength(0) == 0)
		// Child Nodes, added to previously added TreeNode
		TreeNode[] existingNodes = lastAddedNode.Nodes.Find(branch, false);
		if (existingNodes.GetLength(0) == 0)
	lastAddedNode = newNode;
The final step is then finding the child node I want when adding info.
A simple treeview.Nodes.Find(<name>, true) shold serve, but I think it's not working very well or I have messed something. This part should be easy once the adding and sorting is done properly. When trying to find a Node, I will have the entire tree again, so I could start searching from the top one by one.

It looks like it's fairly easy to do, but I can't get it!
Any help appreciated!