If you are using an Access-File as DB.
And specify it as relative path in your app.config file like this
<add name="MSAccess" connectionString="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=..\..\AccessFile\LocalAccess.mdb; User Id=admin;Password=;" providerName="System.Data.OleDb" />If you are using OpenFileDialog or SaveFileDialog
openFileDialog1.DefaultExt = "pdf"; openFileDialog1.Filter = "Technical paper (*.pdf)|*.pdf"; openFileDialog1.FileName = ""; openFileDialog1.InitialDirectory = lastOpenedPath; if (openFileDialog1.ShowDialog() == DialogResult.OK) { // do something }Bad Example - No RestoreDirectory, your access-file will not be found after FileDialog...
openFileDialog1.DefaultExt = "pdf";
openFileDialog1.Filter = "Technical paper (*.pdf)|*.pdf";
openFileDialog1.FileName = "";
//HACK PGfader: necessary so that the relative access file is found after this!
openFileDialog1.RestoreDirectory = true;
openFileDialog1.InitialDirectory = lastOpenedPath;
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
// do something
}
Good Example - RestoreDirectory used, local relative access file after ShowDialog
RestoreDirectory = false is default necessary to set on OpenFileDialog AND SaveFileDialog