Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Listview Search - Partial Search Only Needed

Listview Search - Partial Search Only Needed

Scheduled Pinned Locked Moved Visual Basic
databasetutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hkinser9
    wrote on last edited by
    #1

    Using the code below, I can only do an EXACT seearch for an item in a listview control; however, I'd also like to do a PARTIAL search as well but can't get that working from what I can find. I know there is a FindNearestItems method, but no luck in getting that to work. Any suggestions on how to code the partial search? Here is my code that works well in a doing an EXACT search: Private Sub txtSearch_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSearch.TextChanged Dim Itm As ListViewItem = lstItems.FindItemWithText(txtSearch.Text, True, 0, False) If Not (Itm Is Nothing) Then lstItems.Items(Itm.Index).Selected = True lstItems.EnsureVisible(Itm.Index) lstItems.Focus() End If End Sub

    C 1 Reply Last reply
    0
    • H hkinser9

      Using the code below, I can only do an EXACT seearch for an item in a listview control; however, I'd also like to do a PARTIAL search as well but can't get that working from what I can find. I know there is a FindNearestItems method, but no luck in getting that to work. Any suggestions on how to code the partial search? Here is my code that works well in a doing an EXACT search: Private Sub txtSearch_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSearch.TextChanged Dim Itm As ListViewItem = lstItems.FindItemWithText(txtSearch.Text, True, 0, False) If Not (Itm Is Nothing) Then lstItems.Items(Itm.Index).Selected = True lstItems.EnsureVisible(Itm.Index) lstItems.Focus() End If End Sub

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      I didn't know this was on offer at all. I reckon you'll need to iterate over the items yourself.

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups