TreeView1.Visible = False
TreeView1.Nodes.Clear
MyQuickSort_Tri aryCodeList(), LBound(aryCodeList(), 2), UBound(aryCodeList(), 2), 1, 2, 3, True
For i = LBound(aryCodeList(), 2) To UBound(aryCodeList(), 2)
' Add base node if not already present strNewLang = aryCodeList(1, i)
If strNewLang <> strOldLang Then
' Build a unique key lngKeyCount = lngKeyCount + 1
strLangKey = BuildKey(lngKeyCount, 1)
' Ensure text doesn't exceed 30 chars strKeyText = strNewLang
If Len(strKeyText) > 60 Then
strKeyText = Left(strKeyText, 60)
End If
' Add the new node -- at base frmSnippetBrowser.Visible = False
Set xNod = TreeView1.Nodes.Add(, , strLangKey, strKeyText)
strOldLang = strNewLang
End If
' Add Category if not already present strNewCat = aryCodeList(2, i)
If strNewCat <> strOldCat Then
' Build a unique key lngKeyCount = lngKeyCount + 1
strCatKey = BuildKey(lngKeyCount, 2)
' Ensure text doesn't exceed 30 chars strKeyText = strNewCat
If Len(strKeyText) > 60 Then
strKeyText = Left(strKeyText, 60)
End If
' Add the new node -- below appropriate lang Set xNod = TreeView1.Nodes.Add(strLangKey, tvwChild, strCatKey, strKeyText)
strOldCat = strNewCat
End If
' Add description node beneath applicable category ' Make the key the ID number -- so we can use it to access the code strDescription = aryCodeList(3, i)
strID = aryCodeList(0, i)
intID = Val(strID)
strKeyText = BuildKey(intID, 3)
Set xNod = TreeView1.Nodes.Add(strCatKey, tvwChild, strKeyText, strDescription)
Next
For i = 1 To TreeView1.Nodes.Count
TreeView1.Nodes.Item(i).Expanded = True
Next
' Note number of children in text Dim intChild As Integer
For i = 1 To TreeView1.Nodes.Count
strText = TreeView1.Nodes.Item(i).Text
intChild = Val(TreeView1.Nodes.Item(i).Children)
If intChild > 0 Then
strText = strText & " (" & LTrim(Str(intChild)) & ")"
TreeView1.Nodes.Item(i).Text = strText
End If
Next
TreeView1.Nodes.Item(1).EnsureVisible ' Repositions at the top
TreeView1.Visible = True