TreeView

  • Thread starter Thread starter Wndr
  • Start date Start date
W

Wndr

Hi guys
I have a treeView
MainNode
ChildOfMainNode
ChildOFMainNode2
etc..
Node2
Node3
When I am using the TreeView_AfterSelect function, it's hard fro me to
distinguish between Nodes:
For example if I select ChildOfMainNode it has index 0, ChildOfMainNode2 has
Index 1;
Node2 has Index 1 as well, so what is the best way to distinguish between
Nodes, I assume my way by Index doesn't work. If it's byKey, then how could
I assign the key to this node?
Appreciate any help.
 
Wndr said:
Hi guys
I have a treeView
MainNode
ChildOfMainNode
ChildOFMainNode2
etc..
Node2
Node3
When I am using the TreeView_AfterSelect function, it's hard fro me to
distinguish between Nodes:
For example if I select ChildOfMainNode it has index 0, ChildOfMainNode2 has
Index 1;
Node2 has Index 1 as well, so what is the best way to distinguish between
Nodes, I assume my way by Index doesn't work. If it's byKey, then how could
I assign the key to this node?
Appreciate any help.


well the e.Nodes.FullPath will allow you to distinguish between
different nodes if that is all you are looking for. What exactly are you
trying to accomplish by figuring out which one.
 
You can use the Level property (zero-based) to determine of what level is a
given node. E.g. MainNode would be of zeroth level while
ChildOfMainNode--first.

If you could elaborate more on what you are trying to accomplish, we would
be able to help more.
 
Thanks for both, this is exactly what I was looking for.








- Show quoted text -

Wndr

Just in case you need to search for a particular tree node you might
also want to set the Name property on each of the nodes, as the nodes
are keyed using that property. Obviously it would be best to be
unique, using the FullPath say. If you want to use the IndexOf of
Find functions on the treeview or node it would require the key to be
set.

SMJT
 
Back
Top