Hello,
is it possible to filter a listview to show only bmp or jpeg files that exist in the source directory.
Thanks
Printable View
Hello,
is it possible to filter a listview to show only bmp or jpeg files that exist in the source directory.
Thanks
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.
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
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.
jmcilhinney ... you've helped a lot.
I've got it now
many thanks