OpenFileDialog - display only file names that do not have extensions

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 the user to be able to choose from the following:

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

and files with no extensions , such as:

<w> filewithnoextension



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

I just want to display the names of files that do not have extensions.



Filtering with *. doesn't do the trick. It works great when it does this with a DOS window ( dir *. ), But C # seems to ignore *. filter.





Is there a way to do this using C #?

Thank.

+3
4

, (- , ".XXX" ) , ?

: , . MSDN:

http://msdn.microsoft.com/en-us/library/ms646960(VS.85).aspx

:

CDN_INCLUDEITEM , . , OFNHookProc OFN_ENABLEINCLUDENOTIFY OPENFILENAME . , , CDN_INCLUDEITEM . , .

" " , . , OpenFile, , , . , , , true false.

0

readme . , , , ? -?

№ 1

, , OpenFileDialog , Filter .

, OpenFileDialog, System.IO , DirectoryInfo, Getfiles(), LINQ, FileInfo.Extension.

№ 2

OpenFileDialog , , .

, !

+2

, :

fDialog.Filter = "No extension Files|" + null;

.

, , - .

+1

, *. , , , OpenFileDialog.

, OpenFileDialog , .

, ? , . , , , - , : (

!

0

Source: https://habr.com/ru/post/1745907/


All Articles