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. How can find a listitem item containing some particular text in VB.NET

How can find a listitem item containing some particular text in VB.NET

Scheduled Pinned Locked Moved Visual Basic
questioncsharp
3 Posts 3 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.
  • A Offline
    A Offline
    AR Reddy
    wrote on last edited by
    #1

    Hi I want to get an item from listitem containing some particular text. Using "FindItemWithText" we can do but, this will get all the items that contains the particular text. But I want exact search. For ex: The following are the items in listitem: 201, 100, 2, 150 When I search for item "2", I am getting 201 with "FindItemWithText" as 201 contains 2. How can I get the Item "2"? Thanks in advance,

    AR Reddy

    D J 2 Replies Last reply
    0
    • A AR Reddy

      Hi I want to get an item from listitem containing some particular text. Using "FindItemWithText" we can do but, this will get all the items that contains the particular text. But I want exact search. For ex: The following are the items in listitem: 201, 100, 2, 150 When I search for item "2", I am getting 201 with "FindItemWithText" as 201 contains 2. How can I get the Item "2"? Thanks in advance,

      AR Reddy

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Well, there's no exact match function, so, you can still use that search to return a smaller result set, then do your own string comparison, item-by-item, to find the one that matched exactly. Or, skip searching the ListView and just search the underlying dataset that you used to populate the ListView yourself.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008

      1 Reply Last reply
      0
      • A AR Reddy

        Hi I want to get an item from listitem containing some particular text. Using "FindItemWithText" we can do but, this will get all the items that contains the particular text. But I want exact search. For ex: The following are the items in listitem: 201, 100, 2, 150 When I search for item "2", I am getting 201 with "FindItemWithText" as 201 contains 2. How can I get the Item "2"? Thanks in advance,

        AR Reddy

        J Offline
        J Offline
        Jon_Boy
        wrote on last edited by
        #3

        You can add an 'object' to the listview (as well as the combobox). Therefore you can add a key/item pair to the the listview and get the value based on the key. You have to cast the listview.currentitem to the object type (IE: keyvalue pair).

        Any suggestions, ideas, or 'constructive criticism' are always welcome. "There's no such thing as a stupid question, only stupid people." - Mr. Garrison

        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