Private Type TreeStructure
Id As String
Name As String
End Type
Private Sub Form_Load()
Dim i As Long, n As Integer, TempKey As String
Dim nodx As Node
TreeView1.Style = tvwTreelinesPlusMinusPictureText
For i = LBound(m_stru) To UBound(m_stru)
n = InStrRev(m_stru(i).Id, ".")
If n = 0 Then
Set nodx = TreeView1.Nodes.Add(, , "key" + m_stru(i).Id, m_stru(i).Name)
nodx.Expanded = True
Else
TempKey = Left(m_stru(i).Id, n - 1)
Set nodx = TreeView1.Nodes.Add("key" + TempKey, tvwChild, "key" + m_stru(i).Id, m_stru(i).Name)
nodx.Expanded = True
End If
Next
End Sub