OpenFileDialog does not refresh after selection

G

Guest

I've conquered a very strange behaviour that I cannot account for logically
and therefore seek help in this Discussion Group. I'm currently developing 2
applications and intend to use the standard open File Dialog with the code
snippet found below.
The code snippet is exactly the same in both applications but the behaviour
is fundamentally different. In one application when you select adifferent
filter from the filter selection group box the content of the file chooser is
refreshed. In the other apllication the after changing the filter results in
an empty set of files in the file chooser. Does anybody knowhow I can achieve
a refreshing of the file chooser content in both applications? Or has anybody
had the same problem?
Thank you for your help.
With best regards

Michael


System.Windows.Forms.OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter="Formular (*.form)|*.form|Locale savings(*.fs)|*.fs|All Files
(*.*)|*.*";
ofd.Title= "Open form";
ofd.Multiselect = false;
ofd.FilterIndex = 2;
ofd.RestoreDirectory=true;
System.Windows.Forms.DialogResult test = ofd.ShowDialog();
 
I

Ignacio Machin \( .NET/ C# MVP \)

hi,

Are you sure you are using the smae code in both applications?
If you are you should get the same effect.

Are you running both in the same escenario, from the local computer,
accesing the same folder, etc?

cheers,
 
G

Guest

Hi Ignatio,
yes it's exactly the same code. And they're both accessing the same folder.
Both projects are part of one solution.
The applications run on the same computer and at least 4 pcs have this
problem.

Thnx in advance.

Michael
 
G

Guest

Hi

It's very unlikely that same code shows different results.
Your explenation is too abstract to jadge something, but you can try that:

1) Try to copy that part of code from one app to the other... The code in
both application seems same to you, but may be different in one simbol(filter
string).
2) Alsow if you have that code in separate function, you can try to use
compiled assembly from one app in the other.

I'm shure that after some tests you will found the answer.
 
G

Guest

I tried this also before i wrote to this group. => the source code is the
same :-(

Let me explain it in a different way:
When opening a FileOpenDialog you get all files that match the current
filter.
If you change the filter (e.g. *.* --> *.exe) all files with the file
extension .exe should be shown.
In one of our 2 apps it works without any problems.
In the other no file is shown at all after changing the filter. Even
changing back shows absolutly no results :-( .
The code was copied from the other application (both in one solution, both
are "recompiled"? (dont know the exact english term vs is using here for a
complete new compilation) both access the same folder, error is reproducable
on 4 different PCs) so there can not be any difference :-(.

Thnx in advance

Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top