I have buttons on a form that allow the selected node of a treeview to be repositioned up or down. Everything works fine except the image property. The images do get swapped but clicking on either of the repositioned nodes changes the images back to the original settings even though the nodeclick event does not contain any code to reload the tree. Here is my code:
Set selNode = TreeView1.SelectedItem
strTempName = selNode.Text
strTempTag = selNode.Tag
strTempKey1 = selNode.Key
strTempImg = selNode.Image
'intIndex is the previous or next node in the tree
Set newNode = TreeView1.Nodes(intIndex)
'swap info between selnode and newnode
With selNode
.Text = newNode.Text
newNode.Text = strTempName
.Tag = newNode.Tag
newNode.Tag = strTempTag
.Image = newNode.Image
newNode.Image = strTempImg
.Key = "" ' set to nothing to avoid duplicates
strTempKey2 = newNode.Key ' store newnode key and swap
newNode.Key = strTempKey1
.Key = strTempKey2
End With
Set TreeView1.SelectedItem = newNode
TreeView1.SetFocus
Any ideas how to keep the swapped images from returning to their original values?
Set selNode = TreeView1.SelectedItem
strTempName = selNode.Text
strTempTag = selNode.Tag
strTempKey1 = selNode.Key
strTempImg = selNode.Image
'intIndex is the previous or next node in the tree
Set newNode = TreeView1.Nodes(intIndex)
'swap info between selnode and newnode
With selNode
.Text = newNode.Text
newNode.Text = strTempName
.Tag = newNode.Tag
newNode.Tag = strTempTag
.Image = newNode.Image
newNode.Image = strTempImg
.Key = "" ' set to nothing to avoid duplicates
strTempKey2 = newNode.Key ' store newnode key and swap
newNode.Key = strTempKey1
.Key = strTempKey2
End With
Set TreeView1.SelectedItem = newNode
TreeView1.SetFocus
Any ideas how to keep the swapped images from returning to their original values?