Reputation: 1381
I have a strange situation where I have an rtf file, that while it opens in word, if I select it in an openfiledialog, then it freezes my .NET app and i have to kill the WINWORD.exe process to regain functionality. This is an issue with the preview pane as when it is hidden, there is no problem.
My call to openfiledialog is bog standard.
using (OpenFileDialog openDialog = new OpenFileDialog() { Title = "Select document...", CheckFileExists = true, Filter = "All files (*.*)|*.*" })
{
if (openDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) _FileName = openDialog.FileName;
else return;
}
Other files preview OK, though I anticipate there may be other files may cause a problem, I just haven't found them yet.
As i doubt I can troubleshoot the actual dialog, my workaround is to disable the preview pane - is there any way to do this? of prevent it showing by default?
This is a problem whether the app is run in debug, or standalone.
Upvotes: 7
Views: 2820
Reputation: 61
Use the old Windows 95/98 version of the OpenfileDialog that does not have a Preview pane.
To do this, set the openDialog.AutoUpgradeEnabled
parameter to false
.
Upvotes: 6
Reputation: 61
try using the function Dispose()
of openDialog
before you use rtf file on your code.
Upvotes: 0
Reputation: 19611
Unfortunately, I don't believe that there is much that you can do about this, other than file a bug report with Microsoft.
Upvotes: -1