Saturday, May 16, 2009

Read a Text File Line by Line using C#


Here is the sample code:

string file_name = @"c:\list.txt";
System.IO.StreamReader ObjReader = new System.IO.StreamReader(file_name);
do
{
MessageBox.Show(ObjReader.ReadLine());
} while (ObjReader.Peek() != -1);


Happy Programming !!!!

No comments: