Home - Forums-.NET - FlyTreeView (ASP.NET) - Problems with ChildNodes.Item property in C# (but not VB!)

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

This forum related to following products: FlyTreeView for ASP.NET

Problems with ChildNodes.Item property in C# (but not VB!)
Link Posted: 14-Dec-2006 21:43
Hello,

I am trying to access the last node in a node collection using the following code:

//[C#]
// obtain a reference the last child of the current parent node
FlyTreeNode objNode = ParentNode.ChildNodes.Item(ParentNode.ChildNodes.Count-1);


However, when I attempt to build, the VS.Net validation routinestates that the
'NineRays.WebControls.FlyTreeNodeCollection' does not contain a definition for 'Item'

Not only is this in direct contradiction to the documentation but the same (similar) code works in VB.Net!

' [VB]
' Works!
NodeText2 = LCase(Trim(ParentNode.ChildNodes.Item(I).Text))


I did check VS.NET Help and Google but found nothing to solve the problem.  Any ideas?  Anyone?
Link Posted: 14-Dec-2006 23:40
Probably this will work for C#:

//[C#]
// obtain a reference the last child of the current parent node
FlyTreeNode objNode = ParentNode.ChildNodes[ParentNode.ChildNodes.Count-1];
Link Posted: 14-Dec-2006 23:51
Yup, the IDE seems happy with that.  I am little disappointed that I didn't figure that out myself.

Thanks!