Treeview question

  • Thread starter Thread starter Brian
  • Start date Start date
B

Brian

Hi gurus,

I'm working with a treeview control to show a directory structure. Upon
loading, I want to preselect one of the nodes in the treeview. My code
sort-of works, the branch opens to the right node, but the node itself is
not highlighted. I'm wondering if there's something I can do to make sure a
node is highlighted when I set the SelectedNode property, or if this is just
a limitation of the Compact Framework.

Basically I'm iterating through the nodes until I find the one that matches
my path:

Private Sub FindSelectedNode(ByVal tvwNode As TreeNode)
For Each tNode As TreeNode In tvwNode.Nodes
If tNode.Tag = FilePath Then
tNode.Expand()
tvwDirectories.SelectedNode = tNode
Exit For
Else
FindSelectedNode(tNode)
End If
Next
End Sub

Thanks for any help!

Brian
 
Nevermind! Turned out the control didn't have focus... forcing the control
into focus fixed the problem.
 
Back
Top