[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 371
  • Last Modified:

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

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

  • 2
1 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.

sydneyguyAuthor Commented:
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


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' :-)


Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now