Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to set parent node in TreeView control

Status
Not open for further replies.

cityboy3

Programmer
Nov 6, 2002
41
0
0
US
Can anyone tell me if this is possible?

I have populated a TreeView control on a form in the Form Load event. After the view is populated, I test for certain conditions (not available when the TreeView populates) that would require me to change the Parent node of some of the existing nodes.

I've tried using a line of code that I've seen on Microsoft's support page regarding Drag and Drop:

Set Me!TreeView1.nodes.x(i).Parent = Me!TreeView1.nodes(1)

I keep getting a runtime error "Object doesn't support this property or method"

Is it not possible to change a nodes parent after the initial population of the tree? if you can drag and drop, shouldn't this be possible?

thanks
 
yes it is possible to change the parent node

Code similar to this seems to work for me

Set xtree.Object.Nodes.Item(5).Parent = xtree.Object.Nodes.Item(1)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top