Community Center | Not monitored
Tag not monitored by Microsoft.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
**
how to delete or update a line in a text file using streamwriter ?
**
You shouldn't care about the tags below :) ..
What about using Linq to do something like that
string item = usertxt2.Text.Trim();
var lines = File.ReadAllLines(usersPath).Where(line => line.Trim() != item).ToArray();
File.WriteAllLines(usersPath, lines);
from here: https://www.codeproject.com/Questions/883725/How-to-remove-a-line-from-Text-File-using-Csharp