Solved

Treeview Control: How to find "grandparent"

Posted on 2003-11-08
4
417 Views
Last Modified: 2013-12-26
Hi all--

New to the VB6 treeview control.  I've found that it is easy to get a node's Parent, but what is the best way to find the Parent of a node's Parent (or grandparent as it were).

In other words:

Level 1
     Level 2
          Level 3

How can I find the Level 1 Information when Level 3 is selected?


Thanks,
Damon
0
Comment
Question by:damon98765
[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
  • 3
4 Comments
 
LVL 2

Accepted Solution

by:
gimmeadrink earned 250 total points
ID: 9708846
Use

Form1.TreeView1.SelectedItem.Parent.Parent

HTH
0
 
LVL 2

Expert Comment

by:gimmeadrink
ID: 9708848
I suppose i should explain that better

[level3].parent as you know, gets the parent to the item in level3 (replace [level3] with whatever method you use to get that item).

but the parent of level3, is just another node, so therefore, you can use the parent property to get its parent. hence

[level3].parent.parent

i should have explained this better before.

0
 

Author Comment

by:damon98765
ID: 9710387
Thanks for the help.  Quick, easy & elegant.

D

0
 
LVL 2

Expert Comment

by:gimmeadrink
ID: 9711573
np problem, thanks for the A :)
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

734 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