extracting the node values from treeview  using visual studio 2003  working in c#

Posted on 2006-03-21
Last Modified: 2012-08-13
I wish to cycle through the values in the parent nodes of  a tree view. have all the fields loaded up and that all works fine
am using code
for(int Count = 1 Count < this.treeproject.Nodes.Count;Count++)

       what is needed here is the code to dislpay the values in the nodes
      I can see in debuging the code treeproject.NodeTable.buckets[Count].val  which shows me all the values I want to be able to see but


MessageBox.Show( treeproject.NodeTable.buckets[Count].val)  
when running the code error shows that ""  System.Window.Forms.TreeView.nodeTable '  is inaccessible due to its protection level

in the end all I want to do is to start at the top node and cycle down to the last node parent only and have access to the value and check if it
is checked or not not particular how it gets done just need to access this info

thanks for your help I believe this is easy for all smarties out there  gar

Question by:sydneyguy
    LVL 12

    Accepted Solution

    Instead of using "this.treeproject.NodeTable", have you tried using "this.treeproject.Nodes", as you do in the "for" statement?


    You can also use this.treeproject.Node[Count].Checked to see if it is checked or not.


    Author Comment

    very close not perfect but damn close

    MessageBox.Show(this.treeproject.Node[Count].Text);  does not run but

    MessageBox.Show(this.treeproject.Nodes[Count].Text);  does and gives me access to exactly the data that I want
    so thankyou andy for your promptness take my points with my thanks

    is there some reason I can see treeproject.NodeTable.buckets[Count].val  which shows me all the values I want to be able to see but
    is is inaccessible due to its protection level. even it i want to just read only, or is there just other prefered ways to get the needed info

    thanks again  andy.............  garry  well done

    LVL 12

    Expert Comment


    You can probably see the buckets when you are in quickwatch or something? When you are watching a class you can see a lot of the fields and properties that aren't on the public interface.

    Sorry about the 's' :-)


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
    Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now