Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Integer, ByVal wParam As String, lParam As Any) As Long
Const LB_FINDSTRING = &H18F


Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
ListView1.ListIndex = SendMessage(ListView1.hwnd, LB_FINDSTRING, Text1, ByVal Text1.Text)
End Sub


The above code: When I press any key The item of TreeView1 will change to the other item that has text like string in Text1.

If i use TreeView stead ListView please tell me the change of code above