check if treeview's treenode with a specified text exists

  • Thread starter Thread starter sgalmeida
  • Start date Start date
S

sgalmeida

greetings

how can i check if a treeview contains a treenode with a specified
text? i'm trying with the Nodes.Contains() method but doesn't work.
I'm reading data from a database, and the data is categorized (ex
cars, bikes, trucks, etc). what I want to do is to group on tree
nodes the category of data and then display on child tree nodes the
description of the items within the category. any ideas? If I use the
treeview.Nodes.Contains(new TreeNode("cars")), it does not work.

TIA

Almeida
 
-
how can i check if a treeview contains a treenode with a specified
text? i'm trying with the Nodes.Contains() method but doesn't work.
I'm reading data from a database, and the data is categorized (ex
cars, bikes, trucks, etc). what I want to do is to group on tree
nodes the category of data and then display on child tree nodes the
description of the items within the category. any ideas? If I use the
treeview.Nodes.Contains(new TreeNode("cars")), it does not work.

You have iterate the Nodes collection and compare with TreeNode.Text property.

--
Adrian Mascarenhas, Developer Division

This posting is provided "AS IS" with no warranties, and confers no rights.

Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they originated.
 
Back
Top