ListView 搜索函数
'**************************************
' 函数名: SearchListView
' 描述:ListView 搜索函数
'日期:2005.03.05
'**************************************
Option Explicit
Public Sub SearchListView(ListViewX As ListView, SearchString As String, ListViewZ As ListView)
On Error Resume Next
Dim w, x, y, z As Integer
Dim a, b As String
ListViewX.ListItems.Add , , " "
ListViewX.ListItems.Item(1).Selected = True
SearchString = LCase(SearchString)
Do Until ListViewX.SelectedItem.Index = ListViewX.ListItems.Count
a = LCase(ListViewX.SelectedItem.Text)
z = Len(a)
y = Len(SearchString)
For x = 1 To z
If Mid(a, x, y) = SearchString Then
If ListViewX.SelectedItem = b Then
Else
ListViewZ.ListItems.Add , , ListViewX.SelectedItem
b = ListViewX.SelectedItem
End If
End If
Next x
w = ListViewX.SelectedItem.Index
w = w + 1
ListViewX.ListItems.Item(w).Selected = True
Loop
ListViewX.ListItems.Remove (ListViewX.ListItems.Count)
End Sub