M
mick
I have a small app that contains a RichTextBox which will save its contents
to the apps folder and load it whenever the RTB opens again - at least
that is what is supposed to happen and in fact used to happen.
here is the RTB window load event. It either gets the previously stored
save directory if it exists else the current dir.
private void TextBoxForm_Load(object sender, EventArgs e)
{
if (Properties.Settings.Default.settingsSaveDirectory.Length != 0)
_saveDirectory = Properties.Settings.Default.settingsSaveDirectory;
else
{
Properties.Settings.Default.settingsSaveDirectory
=Directory.GetCurrentDirectory();
Properties.Settings.Default.Save();
}
if (Properties.Settings.Default.settingsDebug) MessageBox.Show("At
TextBoxForm_Load() the save dir is \n" + _saveDirectory);
}
Now I`ve stepped through the code and added a MessageBox at the end to check
what the save dir is and at all points
it`s C:\Program Files\DiskInfo which is as it should be. However it isnt
saving the file there but at
C:\Users\mk\AppData\Local\VirtualStore\Program Files\DiskInfo. Anyone know
why that would be?
The block of code that loads the file is simply
var s = _saveDirectory + "\\" + _fileName;
try
{
if (File.Exists(s))
richTextBox1.LoadFile(s);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
if (Properties.Settings.Default.settingsDebug)
MessageBox.Show("At TextBoxForm Creation the save path is \n" + s);
mick
to the apps folder and load it whenever the RTB opens again - at least
that is what is supposed to happen and in fact used to happen.
here is the RTB window load event. It either gets the previously stored
save directory if it exists else the current dir.
private void TextBoxForm_Load(object sender, EventArgs e)
{
if (Properties.Settings.Default.settingsSaveDirectory.Length != 0)
_saveDirectory = Properties.Settings.Default.settingsSaveDirectory;
else
{
Properties.Settings.Default.settingsSaveDirectory
=Directory.GetCurrentDirectory();
Properties.Settings.Default.Save();
}
if (Properties.Settings.Default.settingsDebug) MessageBox.Show("At
TextBoxForm_Load() the save dir is \n" + _saveDirectory);
}
Now I`ve stepped through the code and added a MessageBox at the end to check
what the save dir is and at all points
it`s C:\Program Files\DiskInfo which is as it should be. However it isnt
saving the file there but at
C:\Users\mk\AppData\Local\VirtualStore\Program Files\DiskInfo. Anyone know
why that would be?
The block of code that loads the file is simply
var s = _saveDirectory + "\\" + _fileName;
try
{
if (File.Exists(s))
richTextBox1.LoadFile(s);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
if (Properties.Settings.Default.settingsDebug)
MessageBox.Show("At TextBoxForm Creation the save path is \n" + s);
mick