hi...now i want to save my output in one text file. My output is arrange in vertically then i save the output in text file. However, when i check that text file, my output is all arrange in horizontal. How to change it to vertical form?? Hope someone can help?

Recommended Answers

All 7 Replies

You have to insert the newline charater, or instead of using Write, use WriteLine.

i used them already.But still the same.

How do you read and display the file?

I display them in list box but the result same as the text file that is in horizontal..I need them in vertical form in text file and list box.

Let's see the code the writes the file, please

FileStream fs = new FileStream(@"C:\Users\Fish\Desktop\fyp-coding\sample1.txt", FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite);//create text file 
            StreamWriter sw = new StreamWriter(fs, Encoding.Default);

            sw.WriteLine(ShowResult.ToString().Trim());// write to the text file         

            sw.Flush();
            sw.Close();
            fs.Close();

this is the write text file codes...

You are only writing one line. How do you know if it is 'vertical' or 'horizontal'?

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.