Treeview

S

Scott Toney

I have a treeview with 2 Root Nodes. The first node has no children whereas
the second node has children. When I click on the "Plus" sign on the second
Root Node, it picks up the first Root Nodes information, shows the
messagebox for First Node. What can I do to prevent that?
In the treeview_afterselect, I have the following:
If (e.Node.GetNodeCount(True) = 0) And (e.Node.IsSelected) Then

'Section 1

If (e.Node.Parent Is Nothing) And (e.Node.GetNodeCount(True) = 0) Then

MessageBox.show("First Node")

LoadRooms(e.Node.Index + 1)

Else

'Section 2

If (e.Node.Parent.Parent Is Nothing) Then

MessageBox.Show("Second Node")

LoadRooms(e.Node.Parent.Index + 1)

end if

end if

end if



Thanks

Scott
 
D

Daniel Moth

Not sure I understand your problem...
the second node has children. When I click on the "Plus" sign on the
second
Root Node, it picks up the first Root Nodes information, shows the
messagebox for First Node. What can I do to prevent that?
When you click on the plus sign of a root node no selection changes take
place so AfterSelect should not fire.

I tried your code with cf v2.0 (don't have vs2003 here) and it works as
expected. On collapse/expand afterselect doesn't fire. "first node" appears
for the first root node and "second node" appears for the children of the
second root node. Obviously I commented out the calls to LoadRooms and
obviously nothing appears when selecting the second root node...

If you have a more precise description of your problem do let us know...

Cheers
Daniel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top