|
|
Title | Allow the user to edit some but not all nodes in a TreeView control in VB .NET |
Keywords | TreeView, VB.NET, edit label, edit node |
Categories | Controls, VB.NET |
|
|
Set the control's LabelEdit property to True to allow the user to edit the control's labels.
In the control's BeforeLabelEdit event handler, decide whether the user should be allowed to edit the selected node's label and set e.CancelEdit to False to prevent the edit. This example prevents the user from editing nodes at the top of the tree.
|
|
' Do not allow the user to edit the root nodes.
Private Sub trvOrg_BeforeLabelEdit(ByVal sender As Object, _
ByVal e As System.Windows.Forms.NodeLabelEditEventArgs) _
Handles trvOrg.BeforeLabelEdit
e.CancelEdit = _
(e.Node.FullPath.IndexOf(trvOrg.PathSeparator) = -1)
End Sub
|
|
|
|
|
|