Roi and how about TYPE('This.Nodes[SelectedKey]') This should work.
>Same deal, This.Nodes[SelectedKey] causes and error. I think I just have to catch the error and go from there.
>
>>Sorry try this one:
>>
>>IF VARTYPE(This.Nodes[SelectedKey]) = 'O'
>> This.SelectedItem = This.Nodes[SelectedKey]
>>ENDIF
>>
>>>I have a method that rebuilds all the nodes in a treeview.
>>>
>>>I save the currently selected node with:
>>>
SelectedKey = This.SelectedItem.Key
>>>
>>>Then I clear all the nodes and rebuild the tree.
>>>
>>>Then I want to reselect the Selected item with:
>>>
This.SelectedItem = This.Nodes[SelectedKey]
>>>This.SelectedItem.ensurevisible
>>>
>>>However sometimes the SelectedKey doesn't exist once the tree is rebuilt. Is there an easy way to determine that? I can't spin through all the keys because I build each branch dynamically as it is expanded. The only thing I've can think of is setting it, catching the error if it doesn't exist, and going on from there.
>>>
>>>tia
Alexandre Palma
Senior Application Architect