+ Reply to Thread
Results 1 to 5 of 5

Count Children of all nodes in a treeview

  1. #1
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    Question Count Children of all nodes in a treeview

    Hi All,

    I'm teaching myself (if you can call it that) how to work with Treeviews at the moment and it's going well.

    what i would like to do is loop through a treeviews nodes, count it's children and alter the text on the treview to show the number of children in each node.

    for example orginal node would look like this:

    Monday

    After (Lets say it has 6 children:

    Monday (6)


    Here's what i have so far:

    Please Login or Register  to view this content.
    any help is greatly appreciated

    i am assuming that you have to populate the treeview first (which I've done) before you can count the children (seems logical).

    Cheers
    Last edited by Macdave_19; 10-18-2010 at 10:05 AM.
    Mr MaGoo
    Magoo.Inc MMVII

    If i've helped please add to my Rep by Clicking on the Blue Scales in the top right hand corner of the post

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Count Children of all nodes in a treeview

    One would assume you want:
    Please Login or Register  to view this content.
    rather than
    Please Login or Register  to view this content.
    within the loop...
    Remember what the dormouse said
    Feed your head

  3. #3
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    Re: Count Children of all nodes in a treeview

    Well spotted on the typo but it still won't count the "Children"?

    it debugs to that part?

    any ideas!

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Count Children of all nodes in a treeview

    Oh, and you need to remove the .Count part.

  5. #5
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    Thumbs up Re: Count Children of all nodes in a treeview

    Awesome!!!!

    Nice one "Breadbin" lol

    if i had read about "Children" in the objecty browser i'd have figured that a long time ago!

    Cheers

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1