'**************************************
' 函数名: 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
' 函数名: 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
解决方案 »
- 我还奇怪为什么没人回复了,仔细一看,被转到[产品/厂家 其他]了
- 怎么把数据保存为二进制文本格式
- VB与Access
- 求crystal report v9.2下载地址
- 使用该VB程序发送MAIL,附件出现乱码,怎么解决?
- 最简单的问题
- treeview 报错
- 有没有这个控件 Microsoft Calendar Control 8.0 ,vb中带的是7.0的.
- 请教高手一个菜单制作问题
- 用固高GE系列控制器,请问用哪种语言较好。谁做过请来指导指导。不胜感激.(没多少分了全用上了)
- MSDN 是什么? 在书店能买着吗?
- 如何实现把SQL中的image类型数据读取出来加载到picture或者image中显示
在ListViewX控件中找出包含SearchString字符的行加入ListViewZ控件 中
Set itmFound = ListView1.FindItem(Text1, lvwText, , lvwPartial)