VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Search - Find ListView Items & SubItems. Enter first few characters and search.

by Sly (2 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 21st May 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Search - Find ListView Items & SubItems. Enter first few characters and search.

Rate Search - Find ListView Items & SubItems. Enter first few characters and search.



'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


Download this snippet    Add to My Saved Code

Search - Find ListView Items & SubItems. Enter first few characters and search. Comments

No comments have been posted about Search - Find ListView Items & SubItems. Enter first few characters and search.. Why not be the first to post a comment about Search - Find ListView Items & SubItems. Enter first few characters and search..

Post your comment

Subject:
Message:
0/1000 characters