check if treeview's treenode with a specified text exists

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
 
A

Adrian Mascarenhas

-
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top