Can treeview in winform be bound to data? I don't know. It contains the treeview usage. Yes.
Source: Internet
Author: User
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 );
}
Else
{
// Create a node object and initialize it
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.