I have a few textboxes above the listview. I would like to filter all the Smiths in the listview if possible. I want to filter either
by filter by LastName / FirstName /Address / Contract / OrderNo or a combination of all.
When using a ListView, I usually create two "helper" functions -- SetupListview(ByRef MyListview as ListView) and LoadListview(ByRef MyListview as ListView).
The first creates the column headers and sets the style, etc.
The second fetches my data (using SQL or whatever), and then adds all the ListItems to the Listview (after clearing out the old Listview contents first)
In your case, do like Eric suggested and modify the WHERE clause in your SQL to include your filtering data (from the textboxes).
You can also get tricky, and change the ORDER BY clause whenever the user clicks on a column header. In this case, store the name of the column the user wants to sort on in a module-level variable, and call LoadListview to re-load the data.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.