Search Item in List View
-
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:
-
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:
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
-
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:
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
-
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
-
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