Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Listview

Status
Not open for further replies.

DANY

Programmer
Mar 13, 2001
4
US
Hello to all,

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.


Thanks for any help
 
DANY -

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.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top