Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
XML RSS Feed
 
 
 
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
TitleAllow the user to edit some but not all nodes in a TreeView control in VB .NET
KeywordsTreeView, VB.NET, edit label, edit node
CategoriesControls, 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
 
 
Copyright © 1997-2003 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated