Hi,
Let's say, i've textfile in D:\files\ as Simple1.txt, Simple2.txt, Simple3.txt. The content of textfile as follow,
Simple1.txt
Next week, i will go to Paris
Simple2.txt
Next month, we play football
Simple3.txt
Hi, my name is Sizuka
How the C# program looks like to read all textfile above and display the content in position 10 to 15 in each file?
Please help
Reading all text files in directory
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Kirtan PatelRank #292 · 8.6K reputationPosted Jun 13, 2009, 4:34 AM EDT
private void btnReadAllFiles_Click(object sender, EventArgs e) { string AllFileData = "" ; string[] x = Directory.GetFiles(@"d:\Files"); foreach (string s in x) { FileInfo f = new FileInfo(s); if (f.Extension == ".txt") { StreamReader sr = new StreamReader(s); AllFileData += sr.ReadToEnd(); } } textBox1.Text = AllFileData; }Ted Snyders2 reputationPosted Sep 8, 2011, 12:46 PM EDT