M
misseill
I am trying to populate a Treeview control with parent Plans and their
child Groups. I wrote code that should generate the following:
Plan 1
==>Group 1
==>Group 2
Plan 2
==>Group 1
==>Group 2
==>Group 3
==>Group 4
Plan 3
==>Group 1
==>Group 2
==>Group 3
==>Group 4
==>Group 5
When the code runs, I only see the following in the treeview:
Plan 1
==>Group 1
==>Group 2
Plan 2
==>Group 3
==>Group 4
Plan 3
==>Group 5
Here is my code. The variable "UBound(gPlanData(i).Group)" is 2, 4, 5
for each plan.
With Me.tvPlanGroup
For i = 1 To 3
Set nodX = .Nodes.Add(, , "Plan " & i, gPlanData(i).Name)
Set nodX = Nothing
y = UBound(gPlanData(i).Group)
For j = 1 To y
Set nodX = .Nodes.Add("Plan " & i, tvwChild, _
"Group " & j,
gPlanData(i).Group(j).Name)
nodX.EnsureVisible
Set nodX = Nothing
Next j
Next i
End With
If there are fewer groups for each subsequent plan, they don't show up
in the tree. This in code:
Plan 1
==>Group 1
==>Group 2
Plan 2
==>Group 1
==>Group 2
Plan 3
==>Group 1
==>Group 2
Shows in my tree as this:
Plan 1
==>Group 1
==>Group 2
Plan 2
Plan 3
Please help me figure out why this is behaving this way. Thanks in
advance, Erika.
child Groups. I wrote code that should generate the following:
Plan 1
==>Group 1
==>Group 2
Plan 2
==>Group 1
==>Group 2
==>Group 3
==>Group 4
Plan 3
==>Group 1
==>Group 2
==>Group 3
==>Group 4
==>Group 5
When the code runs, I only see the following in the treeview:
Plan 1
==>Group 1
==>Group 2
Plan 2
==>Group 3
==>Group 4
Plan 3
==>Group 5
Here is my code. The variable "UBound(gPlanData(i).Group)" is 2, 4, 5
for each plan.
With Me.tvPlanGroup
For i = 1 To 3
Set nodX = .Nodes.Add(, , "Plan " & i, gPlanData(i).Name)
Set nodX = Nothing
y = UBound(gPlanData(i).Group)
For j = 1 To y
Set nodX = .Nodes.Add("Plan " & i, tvwChild, _
"Group " & j,
gPlanData(i).Group(j).Name)
nodX.EnsureVisible
Set nodX = Nothing
Next j
Next i
End With
If there are fewer groups for each subsequent plan, they don't show up
in the tree. This in code:
Plan 1
==>Group 1
==>Group 2
Plan 2
==>Group 1
==>Group 2
Plan 3
==>Group 1
==>Group 2
Shows in my tree as this:
Plan 1
==>Group 1
==>Group 2
Plan 2
Plan 3
Please help me figure out why this is behaving this way. Thanks in
advance, Erika.