OpenFileDialog - only display filenames that have no extensions

Posted by fraXis on Stack Overflow See other posts from Stack Overflow or by fraXis
Published on 2010-05-18T01:00:36Z Indexed on 2010/05/18 1:10 UTC
Read the original article Hit count: 345

Filed under:
|
|
|

Hello,

I have the following code in my C# program:

        OpenFileDialog fDialog = new OpenFileDialog();
        fDialog.Title = "Open a file";
        fDialog.Filter =
           "NCF files (*.ncf)|*.ncf|All files (*.*)|*.*|No Extensions (*.)|*.";



I want to be able to have the user pick from the following:

.NCF (files with .NCF extension only)
*.* (all files)

and files that have no extensions such as:

readme (with no .txt)



I know *.* will do this, but it also displays the .NCF, .TXT, and all other files in the same directory.

I just want to be able to display filenames that have no extensions.



Filtering with *. does not do the trick.



Is there a way I can do this with C#?

Thanks.

© Stack Overflow or respective owner

Related posts about c#

Related posts about openfiledialog