kedaman
Mar 11th, 2001, 10:16 PM
if i remove a node that is being selected, or have been selected recently, the blue box around the next selected item will stay even if i try to select another item, it will jump to the new selected item but then jump back to the item first clicked after the node has been removed.
Private Sub Form_Load()
TreeView1.LineStyle = tvwRootLines
TreeView1.Nodes.Add TreeView1.Nodes.Add(, , , "A"), tvwChild, , "B"
TreeView1.Nodes.Add , , , "C"
End Sub
Private Sub TreeView1_DblClick()
On Error Resume Next
With TreeView1.SelectedItem
Set TreeView1.SelectedItem = Nothing
'For n = 0 To 20000
' DoEvents
'Next n
TreeView1.Nodes.Remove .Index
End With
End Sub
This sample demonstrates the bug, expand the node, and doubleclick on B ot remove it
if i uncomment the for next loop, it will work, most of the time, with 10000 cycles, it will fail more often.
Is there any other way around this problem?
Private Sub Form_Load()
TreeView1.LineStyle = tvwRootLines
TreeView1.Nodes.Add TreeView1.Nodes.Add(, , , "A"), tvwChild, , "B"
TreeView1.Nodes.Add , , , "C"
End Sub
Private Sub TreeView1_DblClick()
On Error Resume Next
With TreeView1.SelectedItem
Set TreeView1.SelectedItem = Nothing
'For n = 0 To 20000
' DoEvents
'Next n
TreeView1.Nodes.Remove .Index
End With
End Sub
This sample demonstrates the bug, expand the node, and doubleclick on B ot remove it
if i uncomment the for next loop, it will work, most of the time, with 10000 cycles, it will fail more often.
Is there any other way around this problem?