I am trying to write a bit of text to a file called reciept.txt. I have included the "System.IO" namespace. When I click the save button it should just write that simple bit of text in the file. When I open the file however, it's just blank. The file already exists.
private void btnSave_Click(object sender, EventArgs e)
{
string deskPath = System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
bool fileExists = File.Exists(DesktopBounds + "/reciept.txt");
using (StreamWriter sw = new StreamWriter(deskPath+"reciept.txt"))
{
sw.WriteLine("asdasdasd");
}
}
Any suggestions why it's not writing even when things look right?