I have implemented a simple function in VB .NET that searches the name of a node inside a TreeView and if found then highlights that specific node. After that I want to expand only the path of the TreeView that the node belongs to.
Is it possible to implement that with a VB function by giving the path of the TreeView or do I have to implement a separate function for that?
Below you can see my code
Private Sub FindRecursive(ByVal tNode As TreeNode)
Dim tn As TreeNode
For Each tn In tNode.Nodes
If tn.Text = itemCode.Text Then
tn.BackColor = Color.Yellow
path1 = tNode.Tag
Dim filename As String = System.IO.Path.Combine(path1, tn.Text)
PictureBox3.Image = Image.FromFile(filename)
'tNode.Expand()
'TreeView1.TopNode.Expand()
'TreeView1.ExpandAll()
'tNode.Expand()
'tNode.ExpandAll()
End If
FindRecursive(tn)
Next
End Sub