treeview控件: 如何删除所选节点下的所有节点
Private Sub deleteChildren()
Dim i As Integer
If treeview1.selectedItem.Children <> 0 then
For i=1 To treeview1.selectedItem.Children
treeview1.Nodes.Remove(treeview1.Child.FirstSibling.key)
Next i
End IF
End Sub
删除某个节点下的子节点就是:
Private Sub deleteChildren(byVal node As Object)
Dim i As Integer
If node.Children <> 0 then
For i=1 To node.Children
treeview1.Nodes.Remove(node.Child.FirstSibling.key)
Next i
End IF
End Sub