1
며칠 동안 붙어 있기 때문에 누군가가 나를 도울 수 있기를 바랍니다.엑셀 형식 treeview의 자식 노드는 부모와 동일한 수준이됩니다.
트리보기에서 시각화하려는 워크 시트가 있습니다. 이것이 내 첫 번째 질문이며 내 평판이 충분히 높지 않기 때문에 이미지가 링크로 제공됩니다. img of Worksheet to visualise
'i:loop through objects
'j:loop through object childs
'counter: keep track of how many childs processed
For i = 1 To 5
Set parentCell = rng.Offset(counter, 0) 'parent values
strParent = parentCell.Value 'parent values
' Build the treeview for both the Left and the right side of the screen
trvLeft.Nodes.Add Key:=strParent, Text:=strParent
trvRight.Nodes.Add Key:=strParent, Text:=strParent
For j = 1 To HelperMethods.AmountInEntity 'can be any number
strPresent = rng.Offset(counter, 6).Value '"x" or ""
'Add to left treeview
Call trvLeft.Nodes.Add(Relative:=strParent, Relationship:=tvwChild, Key:=rng.Offset(counter, 4).Value, Text:=rng.Offset(counter, 4).Value)
'add to right treeview. If not present, mark as red.
If strPresent = "x" The
Call trvRight.Nodes.Add(Relative:=strParent, Relationship:=tvwChild, Key:=rng.Offset(counter, 5).Value, Text:=rng.Offset(counter, 5).Value)
Else
With trvRight.Nodes.Add(strParent, tvwChild, rng.Offset(counter, 5).Value, rng.Offset(counter, 5).Value)
.ForeColor = vbRed
End With
End If
counter = counter + 1
Next j
Next i
뭔가 모든 노드가 같은 수준에 생성 될 때, 그 부모에 노드를 추가하는 잘못.
내가 알아 차린 이상한 점 중 하나는 자녀가 상단에 추가되는 동안 부모가 목록 하단에 추가된다는 것입니다. 사전에 img of flat tree
감사합니다,
필립