views:

242

answers:

3

I am using Folder Browser Dialog in my application to select a folder. Now I want such a thing that in the folder there should be only html files nothing else to be selected. Like if we have open file dialog and only we want to display html file then we use filter property of openfiledialog.So how can I do that in folder browser dialog to remain or select only html files in the folder ?

That is how can I filter files in the folder browser dialog ?

EDIT select only folders containing .HTML.

+2  A: 

Use this as your filter:

HTML files (*.htm; *.html)|*.htm;*.html|All files (*.*)|*.*
Umang
@Umang,Please note that it is folder browser dialog and there is no propery filter for folderbrowserdialog.
Harikrishna
+1  A: 

Is there any particular reason you would use a folder browser dialog when you're selecting a file? An open file dialog is filterable and should be what you're using for file selection.

To get to the real answer: afaik, it's not possible to filter the folder browser dialog.

Julien Lebosquain
@Julien,It is because of user will not have to select all files only he/she will select the folder to select all files.
Harikrishna
+1  A: 

You are asking, and you emphasize in your Edit, to use a FolderBrowser to select files. That is a contradiction. Just use a FileOpen dialog with a *.HTML filter.

Maybe you meant: select only folders containing .HTML, but there is no built in support for that.

Edit

You'll have to think about what this means for nested folders. You would need something that looks ahead at least one level, but any subdir could potentially have HTML files (a few levels down).

Henk Holterman
@Henk Holterman,Yes sir I want to do same that you have specified in your answer in second paragraph.
Harikrishna