nusaiguy

nusaiguy

  • NA
  • 8
  • 0

Help, writing and opening a text file.

Dec 4 2003 3:38 PM
Hey guys, I'm trying to figure out how to get my program to write its informaiton to a .txt file and than be able to open the file up and read it. this is the code for the button private void HMSNviewfile_Click(object sender, System.EventArgs e) { FileStream fs = new FileStream ("list.txt", FileMode.Create, FileAccess.ReadWrite); StreamWriter HMSNfile = new StreamWriter (fs); HMSNfile.WriteLine(" Title :"); HMSNfile.WriteLine(" Tool Number Tool Name Quantity Price "); for (int i=0; i < HMSNNUMBER_OF_RECORDS; i++) { //HMSNfileOutput.Position = i * HMSNRecord.HMSNSIZE; HMSNfile.Write(HMSNblankRecord.HMSNTOOLNO); HMSNfile.Write(HMSNblankRecord.HMSNTOOLNAME); HMSNfile.Write(HMSNblankRecord.HMSNQUANTITY); HMSNfile.Write(HMSNblankRecord.HMSNPRICE); } }

Answers (4)