Hello This is the code i am trying : If the file existes , append to that file else create a new one . I need to write data line by line
FileExists = File.Exists(NewFileName);
if (FileExists = false)
{
using (fs =new FileStream(NewFileName, FileMode.Create))
{
sw = new StreamWriter(fs);
MessageBox.Show(Record);
sw.WriteLine(Record);
fs.Close();
}
}
else
{
using (fd = new FileStream(NewFileName, FileMode.Append))
{
sw = new StreamWriter(fd);
MessageBox.Show(Record);
sw.WriteLine(Record,true);
}
}
}