>.. to assess if current node is last node in tree, you might ..
>if NOT vartype(MyForm.MyTreeView.Nodes(lcCurrentNodeKey).Next=="O" && Then current node is last
>.. and so on.
>
>We also have LASTSIBLING, FIRSTSIBLING, SIBLING, PARENT and others
>HTH:
>
Hi Terry / Bruno,
Thanks for the response and spending your time. This is exactly what I have done if you see the below code. I need to store the .Text values in a cursor in the same order that they are displayed on the treeview (assume that it is fully expanded).
--------
Local oCurNode, nTreeLevel
oCurnode = ThisForm.oleTvwAc.Nodes(i)
nTreeLevel = 0
Do While VarType(oCurNode) = "O"
.....
.....
If !Empty(oCurNode.Children)
oCurNode = oCurNode.Child
nTreeLevel = nTreeLevel + 1
Loop
EndIf
If oCurNode.Key = oCurNode.LastSibling.Key
oCurNode = oCurNode.Parent.Next
Do While VarType(oCurNode) <> "O" And nTreeLevel > 0
oCurNode = oCurNode.Parent.Next
nTreeLevel = nTreeLevel -1
EndDo
Else
oCurNode = oCurNode.Next
EndIf
EndDo
oCurNode = .Null.
---------
This code works fine. (Actually I am at home now, and have typed this code from memory but the code at work place must be the same).
My problem is, the moment I execute the option where this code is put, the form would not close afterwards if I press the close ('x') button on top. Form does not release till I quit the application. Thanks to Fred Tylor of this forum I found out that the culprit could be the pointer 'oCurNode' and it does not release the treeview object, so the form is not closing.
Now is there an alternative way, so that my form would also close?
Thanks in advance
Regards
Vijay