Solved

Change .text on BeforelabelEdit

Posted on 2004-08-16
1
407 Views
Last Modified: 2008-01-09
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!

/Pede

0
Comment
Question by:pede
1 Comment
 
LVL 4

Accepted Solution

by:
ErikPhilips earned 250 total points
ID: 11809370
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.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now