Hello Guy,
Once more I need help with TreeView control.I need a way to check for duplicates value in the tree before saving edited node. I wrote some code but for some reason it’s only get the root of the treeview and not the child nodes.
Please helpCode:Private Sub TreeView1_AfterLabelEdit1(ByVal sender As System.Object, ByVal e As System.Windows.Forms.NodeLabelEditEventArgs) Handles TreeView1.AfterLabelEdit Dim node As TreeNode If Not (e.Label Is Nothing) Then If e.Label.Length > 0 Then If e.Label.IndexOfAny(New Char() {"@"c, "."c, ","c, "!"c}) = -1 Then ' Stop editing without canceling the label change. 'TreeView1.MousePosition) For Each node In TreeView1.Nodes If node.ToString = e.Label.ToString Then e.CancelEdit = True Else e.Node.EndEdit(False) End If Next End If End If End If End Sub
Thank you.




I need a way to check for duplicates value in the tree before saving edited node. I wrote some code but for some reason it’s only get the root of the treeview and not the child nodes.
Reply With Quote