G
Guest
There has been a lot of discussion lately about extending the treeview control to allow finding a node by key rather than by index. Everyone seems to agree that a hashtable is needed to accomplish this. Also, there is a KB article (http://support.microsoft.com/default.aspx?scid=kb;en-us;311318) purporting to show you how to extend the treenode to include a key. This article seems to be nearly useless to me, as (despite adding a DictionaryEntry type property to the treenode) it ends up using a looping function in the extended treeview's CLIENT code to find the node.
Again, it seems everyone agrees that a hashtable is needed. But I don't understand how to do it. I would THINK that I need to override the TreeNodeCollection's Add method to not only add the node to the collection, but also add a (key, index) pair to a hashtable-type property. But I can't seem to do this because replacing a treeview's TreeNodeCollection with an extended TreeNodeCollection requires inheriting the TreeNodeCollection and then calling its New(Owner as TreeNode) sub, which is private.
Is there something I'm missing here? Since I've clearly been unable to understand how to implement the solution that appears to be clear to others, please include an explicit example.
Thanks a lot.
Pat
Again, it seems everyone agrees that a hashtable is needed. But I don't understand how to do it. I would THINK that I need to override the TreeNodeCollection's Add method to not only add the node to the collection, but also add a (key, index) pair to a hashtable-type property. But I can't seem to do this because replacing a treeview's TreeNodeCollection with an extended TreeNodeCollection requires inheriting the TreeNodeCollection and then calling its New(Owner as TreeNode) sub, which is private.
Is there something I'm missing here? Since I've clearly been unable to understand how to implement the solution that appears to be clear to others, please include an explicit example.
Thanks a lot.
Pat