Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

After I add a Node, whether it is SelectedNode or not, I want to mark that node so I can add children to it.

 

tvwDemo.SelectedNodes.Nodes.Add("Item To Add")

 

Once I have done this, how do I get the index or position the node to add a new node to "Item To Add"?

 

tvwDemo.Nodes("Item To Add").Add("Sub 1")

 

What is the best way to position adding to the last node in a TreeNode?

 

Thanks!

 

Barry

  • *Gurus*
Posted

The best way to add treenodes is to create the TreeNode object first, then add it to the treeview:

 

Dim t As New TreeNode("text")
TreeView1.Nodes.Add(t)

 

You can then find out the index of the treenode with the Index property of t.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...