OpenFileDialog.RestoreDirectory no longer works in Vista after installing VS 2008

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi all,

I have an app that relies on OpenFileDialog to change the current
working directory based on the user selection (i.e.
OpenFileDialog.RestoreDirectory = false). It was working fine on
WinXP/2003/Vista. But after I install VS 2008 (which also installed
KB110806 (.Net 2.0 Framework SP1), KB929300 (.Net 3.0 Framework SP2)),
the OpenFileDialog no longer changes the current working directory on
Vista. I wrote a sample app to display the current directory before
and after OpenFileDialog, and the sample app works on:

- XP, with KB110806, KB929300 and .Net Framework 3.5 installed.
- 2003, with KB110806, KB929300, .Net Framework 3.5 installed, VS 2008
installed.

but it doesn't work on Vista with VS 2008 installed. Here's the code-
behind:

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
_lblBefore.Text =
System.IO.Directory.GetCurrentDirectory();
}

private void button1_Click(object sender, EventArgs e)
{
DialogResult result = openFileDialog1.ShowDialog();
if (result == DialogResult.OK)
{
_lblAfter.Text =
System.IO.Directory.GetCurrentDirectory();
}
}

}

Does anyone have a similar problem?
.


Quantcast