|
ms
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
TreeNode.Find() busted?I know, I know... it's rarely the case. But here is a SIMPLE example of it
not working: TreeNode temp = configNode.Nodes.Add("TestNode"); TreeNode[] findResult = configNode.Nodes.Find("TestNode", false); The call to Add works, but I always get a 0 length array back from Find() Anyone see the problem? This casued me a lot of head scratching as well. The problem is that
Nodes.Find() searches on Key rather than Name. If you don't supply a key when you add the node to the tree, one gets assigned for you, and since you don't know it, you'll never be able to find the node! Since key is not unique it would reduce confusion is the assigned key was the same as the name in my opinion Try TreeNode temp = configNode.Nodes.Add("TestNodeKey", "TestNode"); TreeNode[] findResult = configNode.Nodes.Find("TestNodeKey", false); Dave Show quoteHide quote "sklett" wrote: > I know, I know... it's rarely the case. But here is a SIMPLE example of it > not working: > > TreeNode temp = configNode.Nodes.Add("TestNode"); > TreeNode[] findResult = configNode.Nodes.Find("TestNode", false); > > The call to Add works, but I always get a 0 length array back from Find() > > Anyone see the problem? > > >
Other interesting topics
c# CP210x Wrapper InteropServices IntPtr HandleRef problem
Increase all digits in a number(string) one step Anonymous Methods As ThreadStarts Sockets, to be continued... C# Books Refering to Object Members in A Collection in an ASP.NET BoundColu finding the current user name accessing an ASP.NET page Embedding an image in a dll Form Minimize Adding a button click event to my Main function |
|||||||||||||||||||||||