# VBForums CodeBank > CodeBank - Visual Basic 6 and earlier >  VB - How to show "open folder" and "closed folders" in a TreeView

## MartinLiss

The attached project demonstrates how to have a Treeview control display "open folder" and "closed folder" icons.

----------


## vbcooler

can you explain how can i put code that lets say once you click on the "another" folder a msgbox popsup

----------


## snaffles

Hi there fella,

here's how I done it.... Open the Treeview Zip attachment that was posted at the top of this thread by MartinLiss, and open the project.

Then add the code below to the bottom of the treeview form source code.

It checks each node that is double clicked to see if the text for that node is "another". If the text matches, then it throws up the message box at you.


VB Code:
Private Sub JUMP()
MsgBox "You selected the " & Chr(34) & "another" & Chr(34) & " folder", vbInformation, "Another Selection" 'Popup a message box.
End Sub
 Private Sub tvwDemo_DblClick()
    If tvwDemo.SelectedItem.Text = "another" Then
        JUMP    'Call the JUMP Sub, containing the message box.
    End If
End Sub


There are other ways of doing it ... with indexes and stuff... but I found this to be the easiest method.

Hope it's of some help to you.

----------

