I`m writing a Windows Form application.
A text file is storing some names with codes and an index(like: Chris;987;5).
That text file is used then for reading it.
Now, I have 2 textboxes( userTXT and codeTXT) and a button (removeBtn).
A user must write its username in userTXT
and a code that is given by the same application when making an "account" in codeTXT
. When the button is pressed, the program should read the text file (data.txt), remove the line that contains the matching username and code and update the a datagridview which has each username as a row header cell.
The problem:
I`ve tried many ways to delete that line in the txt file (including: making a second instance of the file, removing the line and deleting the original file; using While
function, reading the file to a list and use remove or remove at), but no one of these works. After the button is pressed, the text file looks the same as before trying to delete the line. Tried debugging and no errors, tried breakpoints and I didn`t find anything significant.
Please help me; Thanks in Advance - CCB