TreeView question

  • Thread starter Thread starter Just Me
  • Start date Start date
J

Just Me

In a TreeView when a new node is selected I don't know how to change the
icon of the node that is now no longer selected.

Seems BeforeSelection and AfterSelection events tell only which node is now
selected.


Any suggestions??
 
In a TreeView when a new node is selected I don't know how to change the
icon of the node that is now no longer selected.

Seems BeforeSelection and AfterSelection events tell only which node is now
selected.

Not really looked at these events, but how about having a variable in
the form class that stores the node. This node can be checked in the
SelectedIndexChanged event of the Treeview, modified and then set to
the newly selected node.

Hope this makes sense

Blu
 
* " Just Me said:
In a TreeView when a new node is selected I don't know how to change the
icon of the node that is now no longer selected.

Seems BeforeSelection and AfterSelection events tell only which node is now
selected.

Add a handler to the treeview's 'BeforeSelect' event and check the
treeview's 'SelectedNode' property. This property will contain a
reference to the selected node before the new note is selected.
 
I had thought of that but all kinds of things could happen between saving it
and using it. I'm sure I could make this work - if I have to.

Thanks a lot
 
Herfried K. Wagner said:
Add a handler to the treeview's 'BeforeSelect' event and check the

I did try this but checked the contents of "e".
Guess I didn't see that there was a SelectedNode property.

THANKS
 
* " Just Me said:
I did try this but checked the contents of "e".
Guess I didn't see that there was a SelectedNode property.

'e.Node' will hold a reference to the node that /will be/ selected ;-).
 
Back
Top