I would use the Registry to add an entry for "SavedFileLocation" for your application.
For a tutorial on using the registry, check here.
Then you can check if the key exists, if not present the dialog.
If the key exists, you should check for existence of the file. If the file does not exist, you should probably present this information to the user, and ask them if they want to create a new file there, or choose a new location.
Otherwise, take that value and keep it for runtime.
CODE:
AppInitialization()
{
RegistryKey appKey = Registry.CurrentUser.OpenSubKey(
@"Software\YourName\YourApp"
?? Registry.CurrentUser.CreateSubKey( @"Software\YourName\YourApp" );
this.fileLocation = appKey.GetValue( "SavedFileLocation" )
?? GetLocationFromDialog()
?? "DefaultFileInCurrentDirectory.txt";
}
private static string GetLocationFromDialog()
{
string value = null;
RegistryKey appKey = Registry.CurrentUser.OpenSubKey(
@"Software\YourName\YourApp"
?? Registry.CurrentUser.CreateSubKey( @"Software\YourName\YourApp" );
using( OpenFileDialog ofd = new OpenFileDialog() )
{
if( ofd.ShowDialog() == DialogResult.OK )
{
value = ofd.File;
appKey.SetValue( "SavedFileLocation", value );
}
}
return value;
}