Take the 2-minute tour ×

I have created an application in C#/visual studio 2010.

In that application, i have some background images for software.when i select to change the background of software, it goes to that folder for file selection.

It is working well on win7, but it is not working on winxp on client's system.He says that it goes to last opened folder.

I have set the initial directory path but not working on xp.

share|improve this question
Starting at the last opened folder is the default behavior, you get that when you don't set the InitialDirectory property. Or set it to an empty string. Without any code to look at, the conclusion is that you don't actually set the property. –  Hans Passant Sep 11 '12 at 2:15

2 Answers 2

up vote 0 down vote accepted

Sounds like you need to set the InitialDirectory property of the Dialog.

Setting it to something like 'My Documents' can be done by setting it to:

   openFileDialog1.InitialDirectory = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments)
share|improve this answer
I have a folder in my application folder and i am setting this path when i click on button.it is working in win7.but not in xp. –  t4taurus Sep 11 '12 at 6:07
ah ok, a few things i can think of. Is the path hard coded? If so it might cause issues if the installer allows for the path change etc. Also if the machine is 64-bit or not. If it is 64-bit and your app isn't, it's obviously going to be installed to the Program Files (x68) folder. Some code would help also. :) –  doiley Sep 11 '12 at 10:39

Make sure FileDialog.RestoreDirectory = false; this should solve your problem.

share|improve this answer

Your Answer


