Click here to Skip to main content
15,921,467 members
Home / Discussions / C#
   

C#

 
QuestionTextBox.OnTextChanged - No stack overflow?? Pin
Shy Agam21-Mar-07 7:34
Shy Agam21-Mar-07 7:34 
AnswerRe: TextBox.OnTextChanged - No stack overflow?? Pin
Edmundisme21-Mar-07 7:45
Edmundisme21-Mar-07 7:45 
GeneralRe: TextBox.OnTextChanged - No stack overflow?? Pin
Shy Agam21-Mar-07 8:03
Shy Agam21-Mar-07 8:03 
GeneralRe: TextBox.OnTextChanged - No stack overflow?? Pin
Dave Kreskowiak21-Mar-07 8:12
mveDave Kreskowiak21-Mar-07 8:12 
GeneralRe: TextBox.OnTextChanged - No stack overflow?? Pin
Shy Agam21-Mar-07 8:19
Shy Agam21-Mar-07 8:19 
GeneralRe: TextBox.OnTextChanged - No stack overflow?? Pin
Edmundisme21-Mar-07 8:25
Edmundisme21-Mar-07 8:25 
QuestionPutting Project Under Configuration Control Pin
ross.anderson21-Mar-07 7:34
ross.anderson21-Mar-07 7:34 
QuestionHow do I respond to a protocol like http://, but more like myProtocol:// ? Pin
Program.X21-Mar-07 7:18
Program.X21-Mar-07 7:18 
AnswerRe: How do I respond to a protocol like http://, but more like myProtocol:// ? Pin
Chadwick Posey21-Mar-07 8:11
Chadwick Posey21-Mar-07 8:11 
GeneralRe: How do I respond to a protocol like http://, but more like myProtocol:// ? Pin
Program.X21-Mar-07 12:19
Program.X21-Mar-07 12:19 
QuestionQuestion about Web Services Pin
Khoramdin21-Mar-07 7:07
Khoramdin21-Mar-07 7:07 
Questionmonitor folder Pin
arkiboys21-Mar-07 7:02
arkiboys21-Mar-07 7:02 
AnswerRe: monitor folder Pin
Laxman Auti21-Mar-07 7:19
Laxman Auti21-Mar-07 7:19 
GeneralRe: monitor folder Pin
arkiboys21-Mar-07 22:44
arkiboys21-Mar-07 22:44 
QuestionHow to get the count of lines in .txt file Pin
CodeItWell21-Mar-07 6:59
CodeItWell21-Mar-07 6:59 
AnswerRe: How to get the count of lines in .txt file Pin
Edmundisme21-Mar-07 7:32
Edmundisme21-Mar-07 7:32 
GeneralRe: How to get the count of lines in .txt file Pin
Wayne Phipps21-Mar-07 9:24
Wayne Phipps21-Mar-07 9:24 
I would personally prefer to use StreamReader, it certainly looks more elegant.
int lineCount = 0;
// Create an instance of StreamReader to read from a file.
// The using statement also closes the StreamReader.
using (System.IO.StreamReader sr = new System.IO.StreamReader("myFile.txt"))
{
    // Read and display lines from the file until the end of the file is reached.
    while ( sr.ReadLine() != null) lineCount++;
}
Console.WriteLine( "Line Count: " + lineCount.ToString() );


Obviously you should add some error checking like making sure the file exists ETC but that should otherwise do the job.


Hope it helps




Regards

Wayne Phipps
____________

Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog

GeneralRe: How to get the count of lines in .txt file Pin
Edmundisme21-Mar-07 9:44
Edmundisme21-Mar-07 9:44 
AnswerRe: How to get the count of lines in .txt file Pin
Dave Kreskowiak21-Mar-07 8:47
mveDave Kreskowiak21-Mar-07 8:47 
AnswerRe: How to get the count of lines in .txt file Pin
sherifffruitfly21-Mar-07 18:17
sherifffruitfly21-Mar-07 18:17 
Questionrecieving output from dos Pin
sharpiesharpie21-Mar-07 6:27
sharpiesharpie21-Mar-07 6:27 
AnswerRe: recieving output from dos Pin
szukuro21-Mar-07 6:36
szukuro21-Mar-07 6:36 
AnswerRe: recieving output from dos Pin
Dan Neely21-Mar-07 6:51
Dan Neely21-Mar-07 6:51 
AnswerRe: recieving output from dos Pin
Stefan Troschuetz21-Mar-07 6:54
Stefan Troschuetz21-Mar-07 6:54 
QuestionStrange behaviour Pin
sinosoidal21-Mar-07 6:17
sinosoidal21-Mar-07 6:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.