Author: Xingda Computer technology company (www.study01job.com) Guo Baoli
Here are 3 questions:
1, how to traverse, remove the data to be added to the tree structure.
2, add to what position. We need to determine the parent node in advance.
3. How to add a new node to the specified parent node in the existing tree structure.
The 3rd of the above 3 questions is the simplest. As long as you know the related properties and functions of tree can be solved. Let's solve the simplest one first.
How to add a new node to the specified parent node in the existing tree structure.
Define a variable of type TreeViewItem, and after setting the related property of the variable, use the function InsertItem to insert to the specified position of the specified tree control. The following routine inserts a node below the node, which is the following routine:
TreeViewItem Ltvi_item
Long Ll_handle
Ltvi_item.label = ' content tag '
Ltvi_item.data = ' content tag--data '
Ltvi_item.pictureindex = 1
Ltvi_item.selectedpictureindex = 5
Ltvi_item.children = True
Ll_handle = Tv_1.finditem (roottreeitem!, 0)
If Ll_handle > 0 Then
Ll_handle=tv_1.insertitemlast (0, Ltvi_item)
Else
Messagebox (' Error ', ' no node ')
End If
Not finished, to be continued