OpenFileDialog - show only files modified after certain date

  • Thread starter Thread starter dermot
  • Start date Start date
D

dermot

hi,
I'm opening a file dialog in a vb.net form.

I want to show only files modified after a certain date.
Is there anyway to filter for this?

Thanks
 
I want to show only files modified after a certain date.
Is there anyway to filter for this?

Not with the OpenFileDialog that is built-in. You could certainly create
your own, though.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
To a tea you esteem
a hurting back as a wallet.
 
dermot said:
hi,
I'm opening a file dialog in a vb.net form.

I want to show only files modified after a certain date.
Is there anyway to filter for this?

No. But there is a good reason:

Obviously it can't actually provide direct support for all possible filters
but the reason that it doesn't provided an extensible filter support is to
do with security - Even an untrusted app can be allowed to ask to open a
file via the dialog precisely because it does not expose any information
about the file system to the calling app and it does not allow the app to
disguise the dialog's appearance.

NB To take advantage of this security feature you must call OpenFile() as
this requires only FileDialogPermission whereas File.Open(dialog.FileName)
and other methods of opening a file require FileIOPermission

If you want to do create your own dialog will have to have FileIOPermission
and you cannot derive from OpenFileDialog for the same security reasons.
 
Back
Top