Treeview plus / minus boxes

Treeview plus / minus boxes

Anonymous
Not applicable
259 Views
0 Replies
Message 1 of 1

Treeview plus / minus boxes

Anonymous
Not applicable
Can anyone explain why the first example gives me the plus / minus boxes, but the second example after it does not?

<<< First example >>>
Set nod1 = tvwFiles.Nodes.Add(, , "root", arrFilenames(0), "FolderClosed")
nod1.Expanded = True
nod1.ExpandedImage = "FolderOpen"

For intI = 1 To UBound(arrFilenames)
Err.Clear
Set nod2 = tvwFiles.Nodes.Add("root", tvwChild, , arrFilenames(intI), "Autocad")
If Err = 0 Then AddDummyChild nod2
Next

Sub AddDummyChild(nod1 As Node)
'Add a dummy child node, if necessary
If nod1.Children = 0 Then
'Dummy nodes' Text property is "***"
tvwFiles.Nodes.Add nod1.Index, tvwChild, , "***", "State"
End If
End Sub
<<< First example >>>


But this example does not show the plus / minus boxes? Basically, it's the same code except the first 5 lines are removed (and the .add method parameters changed accordingly):


<<< Second example >>>
For intI = 1 To UBound(arrFilenames)
Err.Clear
Set nod2 = tvwFiles.Nodes.Add(, , , arrFilenames(intI), "Autocad")
If Err = 0 Then AddDummyChild nod2
Next

Sub AddDummyChild(nod1 As Node)
'Add a dummy child node, if necessary
If nod1.Children = 0 Then
'Dummy nodes' Text property is "***"
tvwFiles.Nodes.Add nod1.Index, tvwChild, , "***", "State"
End If
End Sub
<<< Second example >>>

The only difference is I have one more parent node (the folder of the files) on the first example. I'm still adding the dummy child nodes on the second example, so why don't I get the plus / minus boxes?

Thanks,
Tom
0 Likes
260 Views
0 Replies
Replies (0)