|
-
Aug 30th, 2008, 04:57 PM
#1
Thread Starter
New Member
Searching database with partial name
Is there a way to search through a listview using only part of a search name?
For example, if you have a list of cars like "Honda Civic", "Honda Accord", etc.; how can you just type in Honda and have all the Honda results show while all the Toyota, Mazdas, etc. don't show?
-
Aug 31st, 2008, 12:57 AM
#2
Re: Searching database with partial name
There's no way to specifically filter a ListView. To "filter" the data you basically have to remove the items you don't want to display. Not ideal.
vb.net Code:
Dim item As ListViewItem For index As Integer = myListView.Items.Count -1 To 0 Step -1 If myListView.Items(index).Text.Contains("Honda") Then myListView.Items.RemoveAt(index) End If Next
A better option would be to bind data to a DataGridView via a BindingSource. Then you can genuinely filter the data.
-
Sep 1st, 2008, 06:53 PM
#3
Thread Starter
New Member
Re: Searching database with partial name
your code worked perfectly ... and if I knew how to do the other thing you suggested I would (luckily this is just for a demo to get tester feedback) ... thank you again
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|