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

x
?
Solved

Treeview Control: How to find "grandparent"

Posted on 2003-11-08
4
Medium Priority
?
424 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 1000 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

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Suggested Courses

715 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