Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How many parents a child has

Posted on 2004-10-08
3
Medium Priority
?
234 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

688 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