After the treeview is filled is possible to:

count how may AG-xxxxx are in 8501-xxx, count how may items are in each AG-xxxxx, , count how may items are in each SETT. -xx, ....ecc

and store the result in a var

or

count during the treeview is filling and return the result in a var

in effect i want to count how many items are in each node with "+"...
this is my code to fiull treeview:

RSSQL2.MoveFirst
        Do Until RSSQL2.EOF
            sValue = Trim(RSSQL2.Fields("COD_AREA").value)
            sKey = "K" & sValue
            .Nodes.Add , , sKey, sValue & " - " & Trim(RSSQL2.Fields("DESCRIZIONE")), 1, 1
            sValue = "AG. - " & Trim(RSSQL2.Fields("SPORT").value)
            'sSQL = .Nodes.Count
            .Nodes.Add sKey, tvwChild, "L" & sValue, sValue & " - " & Trim(RSSQL2.Fields("DESCRIZIONE2")), 1, 2
            sKey = "L" & sValue
            sValue = "SETT. - " & Trim(RSSQL2.Fields("PROVA3"))
            SSQL = .Nodes.Count
            .Nodes.Add sKey, tvwChild, "M" & sKey & sValue, sValue, 1, 2
            sKey = "M" & sKey & sValue
            sValue = "COPE - " & Trim(RSSQL2.Fields("PROVA1"))
            .Nodes.Add sKey, tvwChild, "N" & sKey & sValue, sValue, 1, 2
            '.Nodes.Item(sKey).EnsureVisible
            RSSQL2.MoveNext
            'sSQL = .Nodes.Count
        Loop

in this case AREA 8501 contain 68 AG. -xxx
in this case Ag. -0300 contain 17 SETT. -XX
in this case SETT. 00 contain 1 item, in this case SETT. 75 contain 1 item

Recommended Answers

All 3 Replies

Try the .Children property

Try the .Children property

tks SCBWV, ....

example about my prob?

Hi,

Try This :

Dim TNode as Node
Set TNode = Trvw.Nodes("AG. -0300") 
'Note Ag.-300 is the Key of the node
MsgBox TNode.Children

Regards
Veena

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.