hie
i just want to know if someone can give me an exemple of how toreplace a data from a single data in a textfile .
i read that i need to use a temporary textfile but i still dont get it
thanks by advance

Recommended Answers

All 5 Replies

i forgot to write
my problem is in c#
thanks

What kind of data do you have, and what to replace?
thx for the answer.

for exemple :
i got a line with : james ,1000
i want to replace 1000 by whats in my textbox
i just cant figure out
the way i did it just erase all my data
thanks

String strFile = File.ReadAllText("c:\\File1.txt");
strFile = strFile.Replace("oldvalue", "newvalue");
File.WriteAllText("c:\\File1.txt", strFile);

wow thank you so much
that was relly helpfull
thanks again

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.