TreeView

  • Thread starter Thread starter Michael Turner
  • Start date Start date
M

Michael Turner

Hi

Can anyone come up with a way to select a node once you can added a new one?
I am trying the following code but it doesn't seem to work.
Dim tnode As New TreeNode("test")

TreeView1.Nodes.Add(tnode)

TreeView1.SelectedNode = tnode

Mike.
 
* "Matt S said:
Try setting TreeView1.HideSelection = False before your code.

Notice that this must only be done once, for example at designtime in
the treeview control's properties window.
 
Following Code invoked from button1 click worked just fine for me.

Dim tn As New TreeNode("newnode")

TreeView1.Nodes.Add(tn)

TreeView1.SelectedNode = tn

If TreeView1.SelectedNode Is tn Then

Debug.WriteLine("Selected")

Else

Debug.WriteLine("Not Selected")

End If

TreeView1.Select()

HTH

rawCoder
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top