VB skills-Tree View TreeView usage skills

Source: Internet
Author: User

VB skills-Tree View TreeView usage skills

1. Add nodes and subnodes for tree browser controls
When you use the ADD method to ADD a new node to the node set in the tree browser, you can declare that it is associated with an existing node. The ADD method is usually used. Its syntax is as follows:
Nodes. Add (relative, [relationship] [, key] [, text] [, image] [, selectedimage])

The meanings of parameters are as follows:
The relationship parameter is another node connected to the new node through the link node parameter;
The relationship parameter may be:
Tvwlast -- 1; this node is placed behind all other nodes of the same level named in relative.
TvwNext -- 2; this node is placed behind the named node in relative.
TvwPrevius -- 3; this node is placed in front of the node named in relative
TvwChild -- 4; this node becomes the child node of the node named in relative
The following is an example:
Dim node1, node2, node3, node4 as Node
Set Node1 = TreeView1.Nodes. Add
TreeView1.Nodes (1). text = "node1"
TreeView1.Nodes (1). key = "node1"
Set node2 = treeview. nodes. add ("node1", tvwChild, "node2 ")
TreeView1.Nodes (2). text = "node2"
TreeView1.Nodes (2). key = "node2"
Insert nodes in sequence.
2. Insert images for nodes
Treeview1.node (3). image = "leaf"
Note that we generally specify the image from imagelist
3. How can I know which node of the tree browser has been clicked when processing node clicks? You can use the NodeClick event:
Public sub treeview1_nodeclick (byval node as comctllib. node)
Text1.text = "you click" & node. text
End sub

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.