How do I get the Tree View to expand once I have add a line and Refresh the view??

Question:

Lets say Ive got a tree view like this:
__________________________
Set objNode0 = TreeView.Nodes.Add(Nothing,”Account Name”) ‘This is the where the first level of the tree is created.
objNode0.tag = objrs.fields(“accountid”).value &””
with objrs
while not (.eof or .bof)
set objNode = TreeView.Nodes.AddChild(objNode0, objRS.Fields(“Account”).Value & “”) ‘This then populates the values under the specified node
.MoveNext
Wend
_______________________
And I wish to return from a dataform and refresh the tree view to display a new line I entered into the treeview via the dataform, BUT, when when I refresh the treeview I want the branch I was on to expand open again.

 

Answer:

When you create the new node, do it this-a-way:

Set MyNewNode = tvTree.Nodes.Add(Nothing, “This is the caption”)
iNodeIndex = MyNewNode.AbsoluteIndex

Then, once your form closes and assuming nothing else gets inserted into the TreeView in the meantime, you can expand the node like this:

tvTree.Nodes.Item(iNodeIndex).Expand True

 

 

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!