vb.net - Searching by the Text property in Treeview.Nodes -


i have winform tree view using vb.net (property named "tvwacct") able search through existing nodes given string ("txtname.text"), , if exists, give user message box warning stop duplicate entries. needs able search parent nodes , child nodes. current tree structure follows:

bank account name

-> sub-account name 1

-> sub-account name 2

-> sub-account name 3

i have looked @ msdn.microsoft , can see nodes.find method exists.

here code:

private sub txtname_validating(eventsender object, eventargs canceleventargs) handles txtname.validating     dim cancel boolean = eventargs.cancel      ' [ other 'if' conditions here ]      if tvwacct.nodes.find(txtname.text, b).length > 0     mymsgbox("sorry, cost centre/bank account exists.", msgboxstyle.information) end if 

whilst debugging using watch feature tvwacct.nodes property, can see code logic works, appears comparing against "name" property of node, rather "text" property. eg. if type along lines of "node0000" in "txtname" box , try leave, error message appear , fail validation.

so, know works, it's not looking @ correct property. know how can force text rather name?

when add nodes treeview, make sure set "name" of node along text.

tvwacct.nodes.add(txtname.text, txtname.text) 

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -