NodeLabelEditEventArgs.Label Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets the new text to associate with the tree node.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

member Label : string with get

Property Value

Type: System.String

The string value that represents the new TreeNode label or null if the user cancels the edit.

The value of this property is null if the user presses ESC to cancel the edit or presses ENTER without modifying the label text. If the user edits the label text, the value of this property is the new label text. This is true even if the final value of edited label text is the same as its original value.

The following example allows the user to edit nonroot tree nodes by using a ContextMenu. When the user right clicks the mouse, the TreeNode at that position is determined and stored in a variable named mySelectedNode. If a nonroot tree node was selected, it is put into an editable state, allowing the user to edit the node label. After the user stops editing the tree node label, the new label text is evaluated and saved. For this example, several characters are considered not valid in the label text. If one of the invalid characters is in the label string, or the string is empty, the user is notified of the error and the label is returned to its previous text.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top