M
marcus.kwok
I am having a weird problem and I have can't figure out why it is
happening. I create an OpenFileDialog and set a filename filter. When
the dialog first opens, the filter works correctly, and only the files
I want to see appear in the file list box. When I change the filter to
one of the other filters, all the files in the list disappear. If I
then manually type a filter into the "Filename" textbox, then the files
appear and the filter changes to the appropriate one. I am confident
that my code is correct, because when I paste it into a test program
the filter works exactly as expected (the file list updates as soon as
I select a different filter).
Here is the code that I am using:
OpenFileDialog* dlg = new OpenFileDialog();
dlg->Title = S"Choose Transmitter file";
dlg->InitialDirectory = S"input";
dlg->Filter = S"Transmitter files (xmtr*.dat)|xmtr*.dat|DAT files
(*.dat)|*.dat|All files (*.*)|*.*";
if (dlg->ShowDialog() == DialogResult::OK) {
textbox_xmtr->Text = dlg->FileName;
}
I have also tried it with a filter that only restricts on file
extension, i.e.,
dlg->Filter = S"DAT files (*.dat)|*.dat|All files (*.*)|*.*";
and I get the same result.
Has anybody seen this issue before?
happening. I create an OpenFileDialog and set a filename filter. When
the dialog first opens, the filter works correctly, and only the files
I want to see appear in the file list box. When I change the filter to
one of the other filters, all the files in the list disappear. If I
then manually type a filter into the "Filename" textbox, then the files
appear and the filter changes to the appropriate one. I am confident
that my code is correct, because when I paste it into a test program
the filter works exactly as expected (the file list updates as soon as
I select a different filter).
Here is the code that I am using:
OpenFileDialog* dlg = new OpenFileDialog();
dlg->Title = S"Choose Transmitter file";
dlg->InitialDirectory = S"input";
dlg->Filter = S"Transmitter files (xmtr*.dat)|xmtr*.dat|DAT files
(*.dat)|*.dat|All files (*.*)|*.*";
if (dlg->ShowDialog() == DialogResult::OK) {
textbox_xmtr->Text = dlg->FileName;
}
I have also tried it with a filter that only restricts on file
extension, i.e.,
dlg->Filter = S"DAT files (*.dat)|*.dat|All files (*.*)|*.*";
and I get the same result.
Has anybody seen this issue before?