Solved

How many parents a child has

Posted on 2004-10-08
3
231 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:knowlton
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
smegghead earned 500 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: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:knowlton
ID: 12261193
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Hey!!!! 1 30
How come this regular expression allows "e"? 14 45
insert value of checklistbox checked 4 32
using sqldatareader to populate cells in Excel-syntax 6 19
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

821 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