R
Richard Lewis Haggard
I want to generate a reasonable but unused file name and pass this name in
to a SaveFileDialog. The problem is, I do not seem to be able to figure out
what the SaveFileDialog class is going to use as an initial directory. In
practice, it appears that the class knows where the previous SaveFileDialog
directory was and it reuses it. I want to know where this directory is so
that I can inspect that location and then generate a suggested file name
that is not currently in use.
Here's the current code:
SaveFileDialog saveFileDialog = new SaveFileDialog();
if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
{
// save the project...
}
saveFileDialog.InitalDirectory is an empty string.
Directory.GetCurrentDirectory() is the location of the application.
When the SaveFileDialog actually displays, it uses the last location used by
this application's last invoked SaveFileDialog.
How can I get the directory that SaveFileDialog is going to use before it
uses it? Without this directory, I can't generate an unused file name.
to a SaveFileDialog. The problem is, I do not seem to be able to figure out
what the SaveFileDialog class is going to use as an initial directory. In
practice, it appears that the class knows where the previous SaveFileDialog
directory was and it reuses it. I want to know where this directory is so
that I can inspect that location and then generate a suggested file name
that is not currently in use.
Here's the current code:
SaveFileDialog saveFileDialog = new SaveFileDialog();
if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
{
// save the project...
}
saveFileDialog.InitalDirectory is an empty string.
Directory.GetCurrentDirectory() is the location of the application.
When the SaveFileDialog actually displays, it uses the last location used by
this application's last invoked SaveFileDialog.
How can I get the directory that SaveFileDialog is going to use before it
uses it? Without this directory, I can't generate an unused file name.