web development India freelance website designer
Description:The purpose of this code is to allow a user to search a treeview for a node. I have tried another one but it didn't work for me.
Assumes:Make sure the treeview hideSelection is not checked in the treeview property pages


Dim srchNode As Node
Dim srchNodeIndex As Integer

Private Sub FindNode(tV As TreeView, findString As String)
'This Subprocedure is used to find the nodes in the treeview
If btnSearch.Caption = "Search" Then
For Each srchNode In tV.Nodes
If srchNode.Text = findString Then
tV.SelectedItem = srchNode
srchNode.EnsureVisible
btnSearch.Caption = "Next"
srchNodeIndex = srchNode.Index
Exit Sub
End If
Next srchNode
ElseIf btnSearch.Caption = "Next" Then
For Each srchNode In tV.Nodes
If srchNode.Index > srchNodeIndex Then
If srchNode.Text = findString Then
tV.SelectedItem = srchNode
srchNode.EnsureVisible
btnSearch.Caption = "Next"
Exit Sub
End If
End If
Next srchNode
End If
MsgBox findString & " was not found.", vbInformation, "Not Found"
btnSearch.Caption = "Search"
srchNodeInde
End Sub
TreeView Search Parent and Child

1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593

Freelance ASP PHP web development | Web developer India Web development India| Prayagasoft - web designer India, Ecommerce developer india, Ecommerce design