if (intBestNumberOfTries > intNumberOfTries)
{
string searchFor = LoginForm.strLoginName;
string line;
using (StreamReader file = new StreamReader(@"NameList.txt"))
{
while ((line = file.ReadLine()) != null)
{
if (line.Contains(searchFor))
{
line.Remove(0);
}
}
}
}
StreamWriter scoreboard = new StreamWriter(@"NameList.txt", true);
scoreboard.WriteLine(""[{0}] " + LoginForm.strLoginName + " scored: {1}", intBestNumberOfTries, intBestNumberOfTries);
scoreboard.Close();
My Loginform.strLoginName;
comes from another programming file. After I run the program, it does not remove the whole line. Instead, it writes a new line.
searchFor
is my login name into the program.