Can't save to text file with visual c# universal app.

Ken Ekholm

New member
Mar 24, 2013
11
0
0
Visit site
I can't save any changes to the text file settings.txt , but reading the file works.
The code is
private async void LedShow_Loaded(object sender, RoutedEventArgs e)
{
var path = @"settings.txt";
var folder = Windows.ApplicationModel.Package.Current.Installed Location;
var file = await folder.GetFileAsync(path);
var lines = await Windows.Storage.FileIO.ReadLinesAsync(file);
sliderDelay.Value = Convert.ToInt32(lines[0]);
textBlockDelayValue.Text = lines[0] + " seconds";
buttonSave.IsEnabled = false;
}
and the error message is

An exception of type 'System.UnauthorizedAccessException' occurred in System.Private.CoreLib.dll but was not handled in user code
Access is denied. (Excep_FromHResult 0x80070005) occurred
Can someone help me?
 

Members online

Forum statistics

Threads
323,303
Messages
2,243,602
Members
428,055
Latest member
DrPendragon