Example of Treeview usage in VB

Source: Internet
Author: User

Set Nod = treeview1.nodes. Add ("stock", tvwchild, "smaterial", "01 (raw material)", 4, 2)
Set Nod = treeview1.nodes. Add ("smaterial", tvwchild, "smimp", "01 (domestic materials)", 4, 2)
Set Nod = treeview1.nodes. Add ("smaterial", tvwchild, "smexp", "02 (export materials)", 4, 2)
Set Nod = treeview1.nodes. Add ("smaterial", tvwchild, "smoth", "03 (other materials)", 4, 2)
Set Nod = treeview1.nodes. Add ("stock", tvwchild, "sproduct", "02 (finished)", 4, 2)
Set Nod = treeview1.nodes. Add ("sproduct", tvwchild, "spimp", "01 (end product)", 4, 2)
Set Nod = treeview1.nodes. Add ("sproduct", tvwchild, "spexp", "02 (exported products)", 4, 2)

Set Nod = treeview1.nodes. Add ("root", tvwchild, "business", "business situation", 4, 2) & #39; Level 1-business situation




Set Nod = treeview1.nodes. Add ("root", tvwchild, "Report", "Report", 4, 2) & #39; Level 1-Report

Nod. Expanded = true & #39; open a node
Nod. ensurevisible & #39; open a node

& #39; open all nodes
For I = 1 to tvleft. nodes. Count
Treeview1.nodes (I). Expanded = true
Next

Summary: Set Nod = listview1.nodes. Add (, "root", "query", 1) & #39; Set Root

After: Set Nod = listview1.nodes. add ("<superior ID>", "<own ID>", "<Name>", <imagelist. index (not selected)>, <imagelist. index (selected)>)

Extended usage:
(1) double-click the node and the node will not be scaled.
Treeview1.selecteditem. Expanded = true

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.