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. C#
  4. Search Item in List View

Search Item in List View

Scheduled Pinned Locked Moved C#
comregexquestion
5 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.
  • M Offline
    M Offline
    MJay
    wrote on last edited by
    #1

    Any1 can advise me what to do if i wan to search an item inside a ListView fill by a datatable according to what user type in a text box. http://img.photobucket.com/albums/v608/mjay83/lookup.jpg[^] above is a screenshot i taken from a software, i just wonder how they do it, user type inside the lookup textbox, then the list view will auto jump and point to the item which match or nearly match with the user input. Any1 please?:doh:

    H R 2 Replies Last reply
    0
    • M MJay

      Any1 can advise me what to do if i wan to search an item inside a ListView fill by a datatable according to what user type in a text box. http://img.photobucket.com/albums/v608/mjay83/lookup.jpg[^] above is a screenshot i taken from a software, i just wonder how they do it, user type inside the lookup textbox, then the list view will auto jump and point to the item which match or nearly match with the user input. Any1 please?:doh:

      H Offline
      H Offline
      HakunaMatada
      wrote on last edited by
      #2

      The listbox responds to two messages: CB_FINDSTRING and CB_FINDSTRINGEXACT These messages are used to find a value in a listbox or a ComboBox.

      --- :beer: Hakuna-Matada :beer: It means no worries for the rest of your days... It's our problem free, Philosophy :jig: It’s rather simple to write an unmanaged C++ application that crashes when it performs a callback. It’s impossible to write a managed application that does the same, thanks to delegates. - Jeff Prosise

      M 1 Reply Last reply
      0
      • M MJay

        Any1 can advise me what to do if i wan to search an item inside a ListView fill by a datatable according to what user type in a text box. http://img.photobucket.com/albums/v608/mjay83/lookup.jpg[^] above is a screenshot i taken from a software, i just wonder how they do it, user type inside the lookup textbox, then the list view will auto jump and point to the item which match or nearly match with the user input. Any1 please?:doh:

        R Offline
        R Offline
        rah_sin
        wrote on last edited by
        #3

        on text boxs textchange event u can try following codes foreach(ListViewItem itr in listView1.Items) { if(itr.SubItems[1].Text==textBox3.Text) { //itr.Focused=true; itr.Selected=true; } else itr.Selected=false; } where subitems[1] is second column so u can write column number which u want to match

        rahul

        M 1 Reply Last reply
        0
        • H HakunaMatada

          The listbox responds to two messages: CB_FINDSTRING and CB_FINDSTRINGEXACT These messages are used to find a value in a listbox or a ComboBox.

          --- :beer: Hakuna-Matada :beer: It means no worries for the rest of your days... It's our problem free, Philosophy :jig: It’s rather simple to write an unmanaged C++ application that crashes when it performs a callback. It’s impossible to write a managed application that does the same, thanks to delegates. - Jeff Prosise

          M Offline
          M Offline
          MJay
          wrote on last edited by
          #4

          sorry but i dun really get ur mean.... i am using a listview instead of a listbox:doh:

          1 Reply Last reply
          0
          • R rah_sin

            on text boxs textchange event u can try following codes foreach(ListViewItem itr in listView1.Items) { if(itr.SubItems[1].Text==textBox3.Text) { //itr.Focused=true; itr.Selected=true; } else itr.Selected=false; } where subitems[1] is second column so u can write column number which u want to match

            rahul

            M Offline
            M Offline
            MJay
            wrote on last edited by
            #5

            hi, thanks for reply i gonna try tat out but 1 thing is, my listview contains more than 7k item, if using this way i think is quite not resource efficency is there other better way?

            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