all groups > vb.net controls > november 2005 >
You're in the

vb.net controls

group:

Treeview Find Node Issue - VB2005


Treeview Find Node Issue - VB2005 Sergio Terenas
11/18/2005 7:26:54 PM
vb.net controls:
Hi all,

I've a Treeview control in a form load with 600 nodes. Each node has a =
text and tag associated to it at the time I add it.

I need to find a node by either the text or the tag, make it the =
SelectedNode and then make sure it's visible on the tree.

I've been playing with the treeview's properties/methods but I think I =
got stuck.

Dim aKey As String =3D txtKey.Text=20
Dim a As Integer
a =3D treeview1.Nodes.IndexOfKey(aKey)
If tvApoderados.Nodes.ContainsKey(aKey) Then
MsgBox("yes
Else
MsgBox("No")
End If

BTW, I'm sure the value of txtKey.text exists in the treeview nodes. =
Could anyone please provide a quick example on how to find/select/show a =
particular node in VB2005 ?

Thanks,

Re: Treeview Find Node Issue - VB2005 Sergio Terenas
11/18/2005 8:06:36 PM
Thanks Herfried for your prompt reply, I forgot to mention those are the
ones I need to find. Only root nodes, no child nodes.
ST


[quoted text, click to view]

Re: Treeview Find Node Issue - VB2005 Herfried K. Wagner [MVP]
11/18/2005 11:58:54 PM
"Sergio Terenas" <sterenas@manquehue.net> schrieb:
[quoted text, click to view]

'TreeView.Nodes' only contains the nodes at root-level. One solution is to
add all the nodes to a 'Hashtable' using the name as key and the node as
value.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Re: Treeview Find Node Issue - VB2005 Edgar Hdz
11/28/2005 12:05:01 PM
Hola
Hablas espanol?

igual te puedo ayudar :S

Edgar

"Sergio Terenas" <sterenas@manquehue.net> escribió en el mensaje
news:eSZz6SJ7FHA.956@TK2MSFTNGP10.phx.gbl...
[quoted text, click to view]

AddThis Social Bookmark Button