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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

treeview

Status
Not open for further replies.

axism

MIS
May 17, 2005
58
Hello, does anyone know about treeview control? can someone give me some help with treeview to list files, subfolders in a directory? last attemp i tried with list box is kinda messy, i have too many sub folders within the directory. I think it should look better in a tree view like explorer. But, I have no idea how to implement that. Can someone please give me some help, perphs some example code would be nice. Thanks
 
Hi
This thread702-879892 has lots of code for treeview.
 
Hi, I was able to add parent and child. But seems mess up, hoping anyone can fix for me. i tested with the following code.
Code:
Private Sub Form_Load()
    treeobj.Nodes.Add , , "a", "a"
    treeobj.Nodes.Add , , "b", "b"
    
    treeobj.Nodes.Add "a", tvwChild, , "apple"
    treeobj.Nodes.Add "a", tvwChild, , "ape"
    treeobj.Nodes.Add "a", tvwChild, , "aaaa"
    treeobj.Nodes.Add "a", tvwChild, , "aol"
    treeobj.Nodes.Add "b", tvbChild, , "banana"
    treeobj.Nodes.Add "b", tvbChild, , "base"
End Sub

out put looks mess up like this:
base
banana
a
b

where a can expand to its child, but b doesnt seem to be working? what did i do wrong?
 
its a typo over tvmChild
Tip: use Option Explicit
 
Anyone know if there's a way to find what's the selected node and return it's key? let say if i have root abc, follow by child, efg, hij, klm, nop, and i m selected nop, how do i find out what's selected and return that? would be something like this:

abc
|
|- efg
|- hij
|- klm
|- nop

if nop was selected, how do i return selected node's key? someone please help. thank you in advance
 

I know this thread is a few days old but just in case your still looking for an answer

treeview1.SelectedItem.Key will return the key

there is a nodeclick event that you can use.

 
that's what I am looking for. Thanks gol4.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top