Joker for a digit in File Dialog Filter

  • Thread starter Thread starter Phil
  • Start date Start date
P

Phil

Hi All!

I would like to filter files, in a file dialog, with
digits in extension only, i.e., files with extensions
from *.000 to *.999. Since I could not find a joker for a
digit, I made a filter in a brute-force way:

fileDialog.Filter = "Test files (*.000 - *.999)|";
int i;
for(i = 0; i < 999; i++)
fileDialog.Filter += "*." + i.ToString("000") + ";";
fileDialog.Filter += "*." + i.ToString("000") + "|All
files (*.*)|*.*";

Although the fileDialog.Filter is complete (i.e., it is
not truncated), choosing "Test files (*.000 - *.999)|" in
a file dialog filters only files with extensions from
*.000 to *.042. Does anyone know how to filter the whole
range?

Happy New Year to all of you,
Phil
 
Hi Phil,

The length of the filter is quite limited, so generating the filter in the
brute-force way won't work just due to the length limitations. On the other
hand, as far as I know, the filter only recognizes good old DOS * and ?
wildcards, and does not allow for regular expressions or something like
that.
 
Back
Top