Windows Develop Bookmark and Share   
 index > Windows Forms General > OpenFileDialog fails to open the specified path
 

OpenFileDialog fails to open the specified path

Hi All,

I am using the OpenFileDialog control. I want to open the a specific Location, Let say "D:\Softwares\\Storage Location\\". I am setting the InitialDirectoryto thatlocation, which i am reading registry to get the location. My problem is:

1. When i execute the code from VS it works fine but when i deploy the application on the machine it always opens "My Documents" folder, untill and unless i browse the specific location once when open dialog is open. From then onwards the dialog opens the specific location instead of "My Documents".

The code i m using is as given below:

openFileToView.InitialDirectory = CSProperties.CurrentStorageDir;

openFileToView.Filter = CSProperties.XML_FILE_FILTER;

openFileToView.Multiselect = false;

if (openFileToView.ShowDialog() == DialogResult.OK)

{

//Some Logic.

}

// CSProperties.CurrentStorageDir is the location read from the registry

Can somewhen suggest me a solution to this problem.

Saurav Dubey  Wednesday, January 30, 2008 8:51 AM
Hi Saurav

Can you please ensure the value returned from CSProperties.CurrentStorageDir; is as desired ??


Thanks n Regards
Anu Viswan
Anu Viswan  Wednesday, January 30, 2008 10:02 AM
Yes Anu the value returned from the CSProperties.CurrentStorageDir is exactly the same as desired. My application is using 2 directories: "Storage Directory" and "Working Directory", so i am getting the value for the Storage Directory.
Saurav Dubey  Wednesday, January 30, 2008 12:38 PM

You can use google to search for other answers

Custom Search

More Threads

• treeview control
• BorderColor for a Standard Button
• Which windows product?
• Show modal messagebox from within a thread
• BAR CODE
• Detect whether Systray is running or not
• When Panel resize needs to resize the inside Button
• Resizing control at the runtime
• Invoke or BeginInvoke cannot be called on a control until the window handle has been created.
• Image quality problem while using GDI+