Link to home
Start Free TrialLog in
Avatar of Figle
Figle

asked on

How to read each line of a text file from a C# web app

I am using a ajax enabled asp 2.0 page in VB.net 2005 page in C#

I need to have my program to read each line of a text file and after that line store that information into a variable then continue to the next line and repeat. please help thanks!
Avatar of brenkehoe777
brenkehoe777

Try this:
StreamReader sr = new StreamReader("c:\\blob.txt");
 
            while (!sr.EndOfStream)
            {
                string line = sr.ReadLine();
            }

Open in new window

Avatar of Figle

ASKER

sorry about the delayed response, work is crazy today and thanks but this only puts the last thing in the text file into the variable, thats where i am stuck at. I am going to post with a better idea of what i need.

ASKER CERTIFIED SOLUTION
Avatar of CuteBug
CuteBug
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial