- Home
·
- Miscellaneous
·
- Search - Find ListView Items & SubItems. Enter first few characters and search.
Search - Find ListView Items & SubItems. Enter first few characters and search.
Search - Find ListView Items & SubItems. Enter first few characters and search.
Rate Search - Find ListView Items & SubItems. Enter first few characters and search.
(1(1 Vote))
'By [email protected]
Dim lvwItm As ListItem
Dim Itm As Integer
Dim SubItm As Integer
Dim Srchx As String
Set lvwItm = ListView1.FindItem(txtFind.Text, , , lvwPartial) 'Search Items
If lvwItm Is Nothing Then ' Search Subitems
Itm = 0: SubItm = 0
For Itm = 1 To ListView1.ListItems.Count
For SubItm = 1 To 3 'Search first 3 Subitems
Srchx = Left(ListView1.ListItems.Item(Itm).ListSubItems.Item(SubItm).Text, Len(txtFind.Text))
If UCase(Srchx) = UCase(txtFind.Text) Then
Set lvwItm = ListView1.ListItems.Item(Itm)
GoTo out01
End If
Next SubItm
Next Itm
Exit Sub 'Not found
out01:
lvwItm.EnsureVisible
lvwItm.Selected = True
ListView1.SetFocus
Else
lvwItm.EnsureVisible
lvwItm.Selected = True
ListView1.SetFocus
End If
End Sub
Search - Find ListView Items & SubItems. Enter first few characters and search. Comments
No comments yet — be the first to post one!
Post a Comment