K
Keith
Hello,
I'm trying to get the "about to be used" directory from an Open/Save file
dialog. I'm not talking about InitialDirectory (which only seems to be
useful if you are setting it) but the directory whose contents will be
displayed when the dialog is shown if InitialDirectory is untouched.
For example, if the user previously browsed to directory FOO using the
SaveFileDialog, I'd like to be able to get that directory from the next
instance of the dialog, BEFORE it is shown or any user interaction takes
place. It is obviously persisted, since it opens there automatically if
InitialDialog is not set, but I can't seem to find the right property or
method to request it. Do I have to get if from somewhere in the Registry?
Is it a system property? An environment setting?
// Nonsesical example code
private void SomeFunction()
{
SaveFileDialog sfd1 = new SaveFileDialog();
sfd1.ShowDialog(); // assume the user browsed to directory A and
saved.
SaveFileDialog sfd2 = new SaveFileDialog();
// Here I want to know what the directory used by sfd1 was.
InitialDirectory is "", but sfd2
// will open to directory A regardless. Where is this value stored?
How can I get it?
sfd2.ShowDialog();
}
Thanks for reading!
Keith
I'm trying to get the "about to be used" directory from an Open/Save file
dialog. I'm not talking about InitialDirectory (which only seems to be
useful if you are setting it) but the directory whose contents will be
displayed when the dialog is shown if InitialDirectory is untouched.
For example, if the user previously browsed to directory FOO using the
SaveFileDialog, I'd like to be able to get that directory from the next
instance of the dialog, BEFORE it is shown or any user interaction takes
place. It is obviously persisted, since it opens there automatically if
InitialDialog is not set, but I can't seem to find the right property or
method to request it. Do I have to get if from somewhere in the Registry?
Is it a system property? An environment setting?
// Nonsesical example code
private void SomeFunction()
{
SaveFileDialog sfd1 = new SaveFileDialog();
sfd1.ShowDialog(); // assume the user browsed to directory A and
saved.
SaveFileDialog sfd2 = new SaveFileDialog();
// Here I want to know what the directory used by sfd1 was.
InitialDirectory is "", but sfd2
// will open to directory A regardless. Where is this value stored?
How can I get it?
sfd2.ShowDialog();
}
Thanks for reading!
Keith