Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OpenFileDialog.InitialDirectory problem

Status
Not open for further replies.

anacris

Programmer
Oct 7, 2003
7
US
Hi, I am using the OpenFileDialog (I open the dialog from different button clicks), and I need to set a different initial directory in each different button click event...
The first time I click the button and the OpenFileDialog is opened the initial directory is just fine, but if I select a file from this directory, the next time I click other button the openFileDialog does not opens in the InitialDirectory (given with penFileDialog.InitialDirectory) but instead it opens with the path of the last directory where I open a file...
Is there I way I can fix this and make the OpenFileDialog to ALWAYS open in the given initialDirectory.
Thanks a lot,
Cristina
 
OpenFileDialog.InitialDirectory property is ONE per each OpenFileDialog object.
If you have two OpenFileDialog controls and for each you set InitialDirectory property with different strings then each dialog window will open IN the initial directory.
Maybe the folder you pass doesn't exist or you use the same control when you click on different buttons.

-obislavu-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top