对Treeview查询节点后,自动点击到此节点上。
代码运行到:ObjectTreeView.nodes(i).Selected就报错了,
我想实现的功能是找到此节点后将光标落在此节点或做一个对节点的点击操作。
但是用ObjectTreeView_nodeClick "ObjectTreeView.nodes(i))"也无法实现,求高人指点。
Private Sub ObjectTreeView_nodeClick(ByVal node As node)
End Sub
Private Sub Cmd_Search_Click()
SearchValue = Txt_Search.Text
For i = 1 To ObjectTreeView.nodes.Count
ObjectTreeView.nodes(i).Expanded = True
If RegExpTest(SearchValue, ObjectTreeView.nodes(i)) Then
ObjectTreeView.nodes(i).Selected
End If
Next
End Sub
Public Function RegExpTest(ByVal patrn As String, ByVal strng As String)
On Error Resume Next
Dim regEx
Set regEx = CreateObject("VBScript.RegExp")
regEx.Pattern = patrn
regEx.IgnoreCase = True
regEx.Global = True
RetStr = regEx.Test(strng)
RegExpTest = RetStr
End Function