VB.NET
Dim strReader as New FileStreamReader("textfile.txt")
While (you still want to read)
somestring = strReader.ReadLine()
DoSomethingWith_somestring
End While
strReader.Close()
- Dan
You could try this code:
int counter = 0;This code is for a winform, but you can simply use it as you want.
string line;
// Read the file and display it line by line.
System.IO.StreamReader file =
new System.IO.StreamReader("c:\\test.txt");
while((line = file.ReadLine()) != null)
{
Console.WriteLine (line);
counter++;
}
file.Close();
// Suspend the screen.
Console.ReadLine();
regards
You will want to use the StreamReader class. Below is the link to MSDN.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemiostreamreaderclasstopic.asp
Got it all solved... Thank you for your help!
0 comments:
Post a Comment