How can I delete text from text file? For example I have some text and every time I would change the text box text in a file will change. This is what I mean:
StreamWriter = sw;
StreamReader = sr;
string path = "file.txt";
string text = txtText.Text;
if(!File.Exists(path))
{
sw = File.CreateText(path)
}
else
{
sw = new StreamWriter(path, true)
}
//here I want to delete previous line
sw.WriteLine(text)
sw.Close()