My wpf application can save a notepad file on the fixed path i provided in
app.config as a key but i want it to be saved on the desktop of...
private void WriteToFile(TextRange textRange)
{
using (StreamWriter oWriter = new
StreamWriter(ConfigurationManager.AppSettings["folderpath"],
true))
{
oWriter.WriteLine(DateTime.Now.ToString());
oWriter.WriteLine("*****************************************************************************");
oWriter.WriteLine(textRange.Text);
oWriter.WriteLine("*****************************************************************************");
oWriter.WriteLine("*****************************************************************************");
oWriter.Write("$");
}
MessageBox.Show(folderpath);
}
the folderpath in the code is a key in app.config with
value="C:\Users\MyPC\Desktop\textfile.txt"
if i delete the key and initialize a string in the code, it shows an error
of Value cannot be null. Please help!
No comments:
Post a Comment