NodeLabelEditEventArgs Class

 

Provides data for the BeforeLabelEdit and AfterLabelEdit events.

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

System.Object
  System.EventArgs
    System.Windows.Forms.NodeLabelEditEventArgs

type NodeLabelEditEventArgs = 
    class
        inherit EventArgs
    end

NameDescription
System_CAPS_pubmethodNodeLabelEditEventArgs(TreeNode)

Initializes a new instance of the NodeLabelEditEventArgs class for the specified TreeNode.

System_CAPS_pubmethodNodeLabelEditEventArgs(TreeNode, String)

Initializes a new instance of the NodeLabelEditEventArgs class for the specified TreeNode and the specified text with which to update the tree node label.

NameDescription
System_CAPS_pubpropertyCancelEdit

Gets or sets a value indicating whether the edit has been canceled.

System_CAPS_pubpropertyLabel

Gets the new text to associate with the tree node.

System_CAPS_pubpropertyNode

Gets the tree node containing the text to edit.

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

The AfterLabelEdit event occurs when the user finishes editing the text for a tree node. The BeforeLabelEdit event occurs when the user begins editing the text for a tree node. A NodeLabelEditEventArgs object specifies the new text to associate with the tree node, the tree node that contains the label to edit, and whether the edit operation has been canceled.

For more information about handling events, see Handling and Raising Events.

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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: