0
votes

I am creating a OpenFileDialog with filter like this:

    OpenFileDialog lfDialog = new OpenFileDialog();
    lfDialog.Filter = "Lizenzdatei|*.cil";
    lfDialog.DefaultExt = "*.cil";

I want that user were able to choose only files with .cil extension. But by typing file name with other then .cil extension in "File Name" field, I'm able to choose any file with any extension that is in current directory. Is there any way to surpass this with OpenFileDialog properties or methods?

1
Came up with next solution: Handle LoadFileDialog.FileOk event and check extansion there. - mcnill

1 Answers

0
votes

Unfortunately no. This validation can be done after user selects its file. (Double clicking file or single clicking and OK Pressing)