I've managed to change individual fields but then end up deleting everything else in the file. I only want to edit one field. Any help would be greatly appreciated. Thankyou
Heres my current code:
Heres my current code:
C#:
public static void UpdatePatientData()
{
string detail, choice;
Console.WriteLine("Please enter the ID of the customer you would like to Update: ");
ID = Console.ReadLine();
string[] Name = File.ReadAllText("user.txt").Split('|'); // each field will represent an index from 1-4
for (int i = 0; i < Name.Length; i++)
{
if (Name[i].Contains(ID))
{
// here is where i would like to edit the name/gender/age etc and write it back to the file
}
}
}
Last edited: