>Worked out how to do it using the treeview.nodes.selected property.
>
>BS
>
>I have a treeview control on a form which I want the user to be able to move items up and down in the node listing one row at a time (i.e.not to a parent node, simply within its own parent node). I have achieved this OK by the use of 2 command buttons (one UP and one DOWN), but in order to get the treeview to display correctly I have to reload the underlying data. In doing so the tree view collapses to the main nodes and the user has to drill back down through the nodes to see if the move has worked (which it has!) and if necessary, move it again as required.
>
>Is there any way to save the status of the treeview prior to refreshing it and then getting VFP to put the tree back to that state, albeit with the entries in different line positions.
>
>I hope I explained that clearly enough....not easy to put into words what I am trying to achieve visually.
>
>Thanks
>Barry Sutton.
Save the key of the node you move.
After refreshing TreeView make this node SelectedItem and make sure that it is Expanded and Visible:
lcNodeKey = thisform.TreeView.SelectedItem.Key
thisform.TreeView.SelectedItem = thisform.TreeView.Nodes(lcNodeKey)
thisform.TreeView.SelectedItem.EnsureVisible()
thisform.TreeView.SelectedItem.Expanded = .t.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.