However, I know that using the corresponding database structure, and then using recursive methods can achieve
The usage of treeview is as follows:
The TreeView component is defined by multiple classes, and the TreeView component is named empty.
The "TreeView" class in "System. Windows. Forms ".
The Node Is In The namespace "System. Windows. Forms ".
"TreeNode" to define. Therefore, when you create a TreeView object in the program,
In fact, it only creates a "Container" that can place nodes ". In this container, add
A node is actually added to a node pair created from the "TreeNode" class.
Delete a node, that is, delete a "TreeNode" Node object.
I. program design and running environment described in this article
(1). Microsoft Windows 2000 Server Edition
(2). Net Framework SDK official version
II. C # Some common methods and specific implementations of the TreeView component:
Although the TreeView component is a troublesome component
Three basic operations can be summarized: adding a child node, adding a sibling node, and deleting a child node.
Node. Master these three common operations and use the TreeView group flexibly in programming.
Parts are very necessary. Next we will introduce them separately.
(1). Add a subnode:
A subnode is the next-level node of the selected node. The
The specific process is: first, locate the bit of the child node to be added in the TreeView component.
Create a Node object, and then use the TreeVeiw class to add nodes
Method (that is, Add () method) to Add this Node object. Below is
Code for adding a subnode to the treeView1 component:
// First, determine whether to select the position in the component.
If (treeView1.SelectedNode = null)
MessageBox. Show ("select a node", "prompt message ",
MessageBoxButtons. OK, MessageBoxIcon. Information );
// Create a Node object and initialize it