Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. COUNT items in node sub node, childre, ...ecc...

COUNT items in node sub node, childre, ...ecc...

Scheduled Pinned Locked Moved Visual Basic
2 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sal21
    wrote on last edited by
    #1

    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

    W 1 Reply Last reply
    0
    • S sal21

      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

      W Offline
      W Offline
      Wendelius
      wrote on last edited by
      #2

      Since you're adding different kind of nodes (AG, SETT...) in that loop, why not simply use counters and calculate each item count. Although if that's the whole logic, won't you have as many AG nodes as there are records in RSSQL2.

      The need to optimize rises from a bad design.My articles[^]

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups