Referencing treeview child-node

M

Morten Snedker

How do I return the level and index of any given node?

Let's say I want to reference the child-node in the third level of a
treeview:

Level-1 -> Level-2 -> Level-3

I'm trying to build the view of folders dynamically, as a node is
doubleclicked, eg:

Level-1: C:\
Level-2: C:\Program Files
Level-3: C:\Program Files\My Program


Thanks in advance for your time and help!


Regards /Morten
 
K

Ken Tucker [MVP]

Hi,

I think this is what you are looking for.
http://msdn.microsoft.com/library/d...temwindowsformstreenodeclassfullpathtopic.asp

Ken
------------------------------
"Morten Snedker" <morten_spammenot_ATdbconsult.dk> wrote in message
How do I return the level and index of any given node?

Let's say I want to reference the child-node in the third level of a
treeview:

Level-1 -> Level-2 -> Level-3

I'm trying to build the view of folders dynamically, as a node is
doubleclicked, eg:

Level-1: C:\
Level-2: C:\Program Files
Level-3: C:\Program Files\My Program


Thanks in advance for your time and help!


Regards /Morten
 
M

Morten Snedker

On Mon, 6 Jun 2005 06:25:48 -0400, "Ken Tucker [MVP]"


Actually I'd already seen that example in the online help. My lack of
patience made me glance instead of reading and understand - since the
FullPath property is what I was missing out on. I ended up with

Dim myFolder As String

Dim lf As ListFolders
lf = New ListFolders(Foldername, False)

lf.Execute()
Dim lfEnum As IEnumerator = lf.GetFolders.GetEnumerator()

While lfEnum.MoveNext()
myFolder = lfEnum.Current
myFolder = myFolder.Substring(InStrRev(myFolder, "\"))
Me.TreeView1.SelectedNode.Nodes.Add(myFolder)
End While

lf = Nothing
Me.TreeView1.SelectedNode.Expand()


....calling it with the TreeView.SelectedNode.FullPath.

Thx for re-routing me. ;-)

Regards /Snedker
 

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

Top