Unlimited add tree node in PB

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.