Re: Treeview searching
From: Tim Baur (trbo20_at_disregard_yahoo.com)
Date: 08/10/04
- Next message: Donald Lessau: "Re: FindFirstFile and underscore"
- Previous message: Ulrich Korndoerfer: "Re: FindFirstFile and underscore"
- In reply to: Tim Baur: "Re: Treeview searching"
- Next in thread: Jon: "Re: Treeview searching"
- Reply: Jon: "Re: Treeview searching"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 10 Aug 2004 10:36:38 -0700
Tim Baur <trbo20@disregard_yahoo.com> wrote in
news:Xns95418869FCCFDtrbo20hotmailcom@207.46.248.16:
> "Jon" <ruffles_@msn.com> wrote in
> news:10hi0n6tmtgeo53@corp.supernews.com:
>
>> My coworker wrote the following code to search a treeview. It works
>> well enough, except that apparently the text of the nodes is blank
>> until the node has been expanded for the first time (so the searching
>> is only finding things in the top level of the treeview). Is there a
>> way to make this work without having to expand every node of the
>> tree?
>> Thanks for any ideas.
>
> Are you using keys? When you add a node, use the optional parameter,
> Key. All of the tree's nodes are stored as a collection and can be
> referenced with:
>
> tvwTree.Nodes("SOME_KEY")
Sorry, I looked a little more closely at your example. I didn't realize
you were searching the Node's text. Instead of recursing the tree, just do
a For Each ... Next on the Tree's Nodes collection.
See if this doesn't work.
Dim oNode As Node
For Each oNode In tvw.Nodes
iFindPos = InStr(1, SiblingNode.Text, strTerm, vbTextCompare)
If iFindPos > 0 Then
oNode.Selected = True
Exit For
End If
Next oNode
- Next message: Donald Lessau: "Re: FindFirstFile and underscore"
- Previous message: Ulrich Korndoerfer: "Re: FindFirstFile and underscore"
- In reply to: Tim Baur: "Re: Treeview searching"
- Next in thread: Jon: "Re: Treeview searching"
- Reply: Jon: "Re: Treeview searching"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|