[2005] Creating a Folder Browser Filter
hey all, ok basically im trying to make a sort of folder browsing program, it has a button to add the names of all the files including their extensions in a folder into a text box using the folder browser dialog.
i also have a combo box, and, in there i want to display a list of all the file extensions (except when the text box is empty i want it to display something like "no files selected").
once a user has selected an extension from the combo box i want the program to only display the files with the selected extension in the text box and if not extension is selected i want the text box to display all the files.
also another thing im trying to do well two things actually is, 1. i want a lable to display the file path of all the files up to the folder they are in, so for example, if example.txt is in folder documents i want the lable to display summet like C:\blah\blah\documents, and 2. i want another lable to display a the number of files in the folder.
does anyone have any idea how im even supposed to approach any of these, any hints or tips are greatfully appreciated
thanks in advanced
Re: [2005] Creating a Folder Browser Filter
any ideas on this subject at all?
Re: [2005] Creating a Folder Browser Filter
I don't know exactly what you mean, but if you can use an OpenFileDialog instead of a FolderDialog you can set the Filter property to make it show only the files with a certain extension.
The filter property is a string that first takes the 'display' of the filter (which is displayed in the dialog) and then the actual filter, separated by a |. Here is an example:
Code:
OpenFileDialog1.Filter = "Text files (*.txt)|*.txt|Bla files (*.bla)|*.bla|All files|*.*"
This will show three options in the Filter combobox (in the openfiledialog):
"Text files (*.txt)" (if this is selected, only .txt files are shown)
"Bla files (*.bla)" (if this is selected, only .bla files are shown)
"All files" (all files are shown).
Re: [2005] Creating a Folder Browser Filter
nah i need to use teh folder browser dialog, and i need the filter to be put in after wards, so like once all the files are displayed in the text box, i need to have a combo box that includes all of the file extensions of the displayed files, and then i can choose one of the extensions in that combo box, once that is done only the files with that extension is displayed in teh text box,
its part of a tutorial question in uni here is the question if that helps
Select Folder shows Folder Browser Dialog, and when a folder is selected,
the names (without paths) of all files within that folder are listed inside the
Text Box, the total number of items is listed in the label below, and the
selected folder is listed in the label above.
The extension filter Combo box shows initial entry <none>. When a folder
is selected this fills with a list of all file extension sorted in alphabetical order.
When an item is selected, only those file types are listed, with the total numberlabel being updated accordingly.
Re: [2005] Creating a Folder Browser Filter