|
-
Feb 6th, 2006, 08:51 AM
#1
Thread Starter
Lively Member
[RESOLVED] Filter a list view
Hello,
is it possible to filter a listview to show only bmp or jpeg files that exist in the source directory.
Thanks
-
Feb 6th, 2006, 05:32 PM
#2
Re: Filter a list view
A ListView displays what you put in it. If you only want to display certain files then only put thise files in in the first place. I assume that you are calling GetFiles to get the file list. GetFiles is overloaded and allows you to specify a filter, so if you use that then you will only get the files you want in the first place.
Having said that, the ExtendedListView in the free Quantum Windows Forms Components library (see my signature for link) supports complex data-binding. If they have created that to mimic the way it works with a DataGrid then you could use a DataTable and set its DefaultView.RowFilter property to filter what's displayed.
-
Feb 7th, 2006, 12:15 AM
#3
Thread Starter
Lively Member
Re: Filter a list view
Thanks for the great tip.
I am now using getfiles("*.jpg")
Which works great ...BUT
if i try
GetFiles("*.jpg *.jpeg") I get nothing
or
GetFiles("*.jpg *.jpeg") I get an error
Could you tell me the proper syntax for multiple file types.
Basically I need to look for all the usual image file types.
Thanks
-
Feb 7th, 2006, 12:47 AM
#4
Re: Filter a list view
The proper syntax is to make the call multiple times for multiple filters. You shouldn't have to worry about combining and sorting the arrays because the ListView can do that for you, but you can do it yourself if you want.
-
Feb 7th, 2006, 01:10 AM
#5
Thread Starter
Lively Member
Re: Filter a list view
jmcilhinney ... you've helped a lot.
I've got it now
many thanks
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
|