rajesh.forum
Well-known member
- Joined
- Sep 7, 2007
- Messages
- 55
- Programming Experience
- Beginner
Hi all!
i need Common function to check if there is existing nodes in treeview.
i cud nt write a function for this because the user will enter the node dynamically in my form.Please assume that there is 'n' no of node levels..
I ve used "for each" loop for each nodes and its childs..
Here is the sample code that i ve tried..
With regards
rajesh
i need Common function to check if there is existing nodes in treeview.
i cud nt write a function for this because the user will enter the node dynamically in my form.Please assume that there is 'n' no of node levels..
I ve used "for each" loop for each nodes and its childs..
Here is the sample code that i ve tried..
VB.NET:
For Each tNode As TreeNode In tvMenu.Nodes
If tNode.Text = tbMenuName.Text Then
errMenu.ForeColor = Color.Red
errMenu.Text = "Menu Name Already Exist"
Else
For Each child As TreeNode In tNode.Nodes
If child.Text = tbMenuName.Text Then
errMenu.ForeColor = Color.Red
errMenu.Text = "Menu Name Already Exist"
End If
Next
End If
Next
With regards
rajesh
Last edited by a moderator: