Hi, i have a form with data and I am tryin to save and load data using a texfile, any suggestion how I could start this as Im not too sure, thanks
ppatryk 0 Newbie Poster
Recommended Answers
Jump to PostYup
StreamWriter fileOut = new StreamWriter("file.txt"); fileOut.WriteLine("stuff goes here"); fileOut.Close();
then...
string strData = ""; StreamReader fileIn = new StreamReader("file.txt"); while(!fileIn.EndOfStream) { strData = fileIn.ReadLine(); } fileIn.Close();
Jump to Postthines has a good suggestion.
If you are going to be holding many different pieces of data I would recommend delimiting the data in some fashion or otherwise structuring your file so that there is a "table of contents" so to speak so you can find where certain data …
Jump to PostXML works, but I avoid it like the plague.
XML files are bloated for the sake of "human readability."
I always use straight up binary serialization. You could always include a "export to XML" feature :)
All 11 Replies
thines01 401 Postaholic Team Colleague Featured Poster
zachattack05 70 Posting Pro in Training
ChrisHunter 152 Posting Whiz in Training Featured Poster
zachattack05 70 Posting Pro in Training
ChrisHunter 152 Posting Whiz in Training Featured Poster
zachattack05 70 Posting Pro in Training
ppatryk 0 Newbie Poster
ppatryk 0 Newbie Poster
zachattack05 70 Posting Pro in Training
ppatryk 0 Newbie Poster
zachattack05 70 Posting Pro in Training
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.