This project is read-only.

TreeView.Get(string id) always returns null

Jul 22, 2008 at 6:25 PM

First off, great work. I've been taking a look at it and noticed that the implementation of TreeView.Get will always return null. This is because within the recursive method TreeViewNode.Get no test is made against the current node hence all the method does is recurse down through the tree of nodes without actually doing anything. The following would fix it:

public TreeViewNode Get(string id) {
    if(string.Compare(this.ID, id, StringComparison.CurrentCulture) == 0) 
return this;
TreeViewNode node = null;
foreach(TreeViewNode node2 in this.TreeViewNodes) {
        node = node2.Get(id);
if(node != null) {
return node;
return node;

-- sk --

Jul 23, 2008 at 4:22 AM
Thanks, will check and merge for next minor release.