C # WinForm TreeView node (node) rename or get node modified value

Source: Internet
Author: User

In the process of program development we often use the TreeView, but also often to modify the name of the node. The node name is modified to update the database in a timely manner. Then the question is, how do you get the updated value of node? I tried a lot of methods to finally analyze the AfterLabelEdit event of the TreeView node name modification. There are two parameters in the event such as code sender and E.

private void Treeview2_afterlabeledit (object sender, NodeLabelEditEventArgs e)
{


}

The E in the code has two values, e.lable and E.node. Lable is the currently modified value, node is the currently modified contact.

Suppose that the name of a node before the modification is "NODE01", we want to modify the name to "Node 01", then we have three ways to verify.

treeview1.selectednode.text--"NODE01

e.node.text--"NODE01

e.lable--"Node 01

When you change a node to an edit state and the content is not modified, the value of E.lable is NULL.

C # WinForm TreeView node (node) rename or get node modified value

Related Article

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.