D
David C. Holley
I have a TreeView control which lists out Invoices when the TreeView is
first loaded as in...
Invoice #1
Invoice #45
Invoice #75
Awhile back I needed to clean up the overall form, so I converted the
various command buttons to child 'action' nodes that I place under the
Invoice node when the Invoice is clicked (via the _NodeClick event). the
sub AddActionNodes() creates the nodes when the first Invoice is
clicked. (MoveActionNodes() changes the .Parent property of the action
nodes to move them.)
So when you click on Invoice #45 the nodes are added and the TreeView
becomes via AddActionNodes()
Invoice #1
Invoice #45
Create Reservation
Email Confirmation
Print Purchase Orders
Invoice #75
When another Invoice node is clicked, the child 'action' nodes are moved
to the Invoice node by changing the .Parent property of each of the
nodes via MoveActionNodes()
[Code that loops through the Nodes collection deleted]
Set node.Parent = newParentNode
All of that works like a charm, *BUT* when MoveActionNodes() is first
called (eg on the SECOND time an Invoice node is clicked), the child
'action' nodes are placed under the new Invoice node in descending order
as in
Print Purchase Orders
Email Confirmation
Create Reservation
For each subsequent time that MoveActionNodes() runs the nodes are moved
in the same descending order to the new Invoice.
*Why?*
(As a temp fix, I changed AddActionNodes to add the nodes in descending
order and then did a sort)
first loaded as in...
Invoice #1
Invoice #45
Invoice #75
Awhile back I needed to clean up the overall form, so I converted the
various command buttons to child 'action' nodes that I place under the
Invoice node when the Invoice is clicked (via the _NodeClick event). the
sub AddActionNodes() creates the nodes when the first Invoice is
clicked. (MoveActionNodes() changes the .Parent property of the action
nodes to move them.)
So when you click on Invoice #45 the nodes are added and the TreeView
becomes via AddActionNodes()
Invoice #1
Invoice #45
Create Reservation
Email Confirmation
Print Purchase Orders
Invoice #75
When another Invoice node is clicked, the child 'action' nodes are moved
to the Invoice node by changing the .Parent property of each of the
nodes via MoveActionNodes()
[Code that loops through the Nodes collection deleted]
Set node.Parent = newParentNode
All of that works like a charm, *BUT* when MoveActionNodes() is first
called (eg on the SECOND time an Invoice node is clicked), the child
'action' nodes are placed under the new Invoice node in descending order
as in
Print Purchase Orders
Email Confirmation
Create Reservation
For each subsequent time that MoveActionNodes() runs the nodes are moved
in the same descending order to the new Invoice.
*Why?*
(As a temp fix, I changed AddActionNodes to add the nodes in descending
order and then did a sort)