Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How many parents a child has

Posted on 2004-10-08
3
Medium Priority
?
235 Views
Last Modified: 2010-04-15
In a Tree View control how can I find out how many parents a selected node has?

For example:


Main  (has 0 "parents")
      Main Child  (has 1 "parents")
             Main Grandchild  (has 2 "parents")
                      Main Great Grandchild   (has 3 "parents")
                      Main Great Grandchild   (has 3 "parents")
                                Main Great Great Grandchild   (has 4 "parents")



0
Comment
Question by:Tom Knowlton
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
smegghead earned 2000 total points
ID: 12260380
Yes..

tvMain.PathSeparator="\t"; // Set this to something which doesn't occur in any of your nodes.

TreeNode TN=MySelection;
Parents=TN.FullPath.Length-TN.FullPath.Replace("\t","").Length;

Smg
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 12261164
Perfect!!!

From this I built a function which can tell me how many parents a child node has.......which I can call when the node is selected.

Yahoooo!
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 12261193
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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!
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

824 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