This documentation is archived and is not being maintained.

Visual Basic: Windows Controls

Visual Studio 6.0

LabelEdit Property

See Also    Example    Applies To

Returns or sets a value that determines if a user can edit labels of ListItem or Node objects in a ListView or TreeView control.


object.LabelEdit [ = integer]

The LabelEdit property syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
integer An integer that determines whether the label of a Node or ListItem object can be edited, as specified in Settings.


The settings for integer are:

Constant Value Description

0 (Default) Automatic. The BeforeLabelEdit event is generated when the user clicks the label of a selected node.

1 Manual. The BeforeLabelEdit event is generated only when the StartLabelEdit method is invoked.


Label editing of an object is initiated when a selected object is clicked (if the LabelEdit property is set to Automatic). That is, the first click on an object will select it; a second (single) click on the object will initiate the label editing operation.

The LabelEdit property, in combination with the StartLabelEdit method, allows you to programmatically determine when and which labels can be edited. When the LabelEdit property is set to 1, no label can be edited unless the StartLabelEdit method is invoked. For example, the following code allows the user to edit a Node object's label by clicking a Command button:

Private Sub Command1_Click()
   ' Determine if the right Node is selected.
   If TreeView1.SelectedItem.Index = 1 Then
      TreeView1.StartLabelEdit ' Let user begin editing.
   End If
End Sub