+ Reply to Thread
Results 1 to 6 of 6

Get a list of all selected child nodes of a treeview

Hybrid View

  1. #1
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,785

    Get a list of all selected child nodes of a treeview

    Hi,

    It is theoratical query actually.

    I want to loop through all the parent nodes of TreeView1 then inside that loop I want to get list of all childern (of what ever parent) like bellow

    For Each Node in TreeView1.Nodes
    For Each Child In Node.Childeren
    If Child is selected then  'This is where is don't know how get the selected property of the child
    'Something
    Next Child
    Next Node
    Help would be greatly appreciated.

    Imran Bhatti
    Teach me Excel VBA

  2. #2
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Get a list of all selected child nodes of a treeview

    I assume you have the CheckBoxes style as "True" and that is how you are selecting multiple nodes. Then your code is simply:

    Dim n As Node
    
    For Each n In TreeView1.Nodes
        If n.Checked Then ...
    Next n
    WBD
    Office 365 on Windows 11, looking for rep!

  3. #3
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,785

    Re: Get a list of all selected child nodes of a treeview

    Thanks WBD for the review.
    Yes . All parents and childs have CheckBoxes Style.

    Will the checked property also work for childeren of "n" as well?. I am currently not on the PC where this project is kept.

  4. #4
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,785

    Re: Get a list of all selected child nodes of a treeview

    I mean how should I get the list of all childeren which are currently selected

  5. #5
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Get a list of all selected child nodes of a treeview

    The nodes collection includes all nodes in the treeview; regardless of where they are in the hierarchy.

    WBD

  6. #6
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,785

    Re: Get a list of all selected child nodes of a treeview

    Thanks a lot WBD it helped

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Finding Values in Nodes and Child Nodes in XML SOAP POST
    By Julesdude in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-25-2018, 11:33 AM
  2. [SOLVED] Transfer ALL nodes from a UserForm TreeView into a TreeView on a worksheet with VBA
    By Jerbinator in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-04-2015, 07:52 AM
  3. [SOLVED] Expand TreeView nodes
    By zplugger in forum Excel General
    Replies: 5
    Last Post: 01-08-2015, 07:57 AM
  4. [SOLVED] Error Whilst Updating Nodes On A Treeview
    By ajryan88 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-23-2013, 04:49 PM
  5. [SOLVED] SUM Quantity all Child in Treeview - Help me how?
    By ctinvoip in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-02-2012, 10:25 AM
  6. TreeView, selected element and all below
    By lenrok in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-04-2011, 10:17 AM
  7. Count Children of all nodes in a treeview
    By Macdave_19 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-18-2010, 10:05 AM

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