• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 424
  • Last Modified:

Change .text on BeforelabelEdit

Hi, Im trying to change the text of a node (in a TreeView), just before the user starts to edit it. Imagine the text of the node is "Products (100)". When the user edits this nodes text, he's only supposed to edit the "products" text, not the "(100)". That is an autogenerated text I add.

This little sample shows the problem:

private void treeview_BeforeLabelEdit(object sender, System.Windows.Forms.NodeLabelEditEventArgs e)
  ((TreeNode)e.Node).Text = "TEST";

The text "TEST" is never shown, the user gets to edit the text that was in the label, before this event. Is there any wordaround for this?

Thanks in advance!


1 Solution
I had simlar issues.  I had to take a alternate course of action and create a textBox that populated the value of the selectedNode.  When the textBox changed, I updated the node.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now