views:

74

answers:

1

I have a TreeView with user-editable nodes. I like to use the node caption as key to my tree node :

+ Root
|+ Node1
||- SubNode1
||- SubNode2
|+ Node2
||- SubNode3
||- SubNode4

So I can reach a node like this:

MyTreeView.Nodes["Root"].Nodes["Node2"].Nodes["SubNode3"]

The problem is that, as I allow the user to rename any node, I would need also to change the key of my node in its parent in the AfterLabelEdit handler... which seems (logically) not to be done automatically. Unfortunately, Nodes["blabla"] is readonly, Nodes.Add(string Key, TreeNode Node) doesn't exist, and I can't find a way to do this without throwing (sooner or later) a bad exception.

Any idea ?

A: 

Well, changing the Node.Name property seems to work...

Blitzz