Message 1 of 1
Treeview plus / minus boxes
Not applicable
04-26-2005
01:03 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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
<<< 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