.txt file help
.txt file help
.txt file help
.txt file help
.txt file help
.txt file help .txt file help .txt file help .txt file help .txt file help .txt file help .txt file help .txt file help
.txt file help .txt file help
.txt file help
Go Back  Xtreme Visual Basic Talk > > > .txt file help


Reply
 
Thread Tools Display Modes
  #1  
Old 09-14-2005, 12:20 PM
Talk2Tom11's Avatar
Talk2Tom11 Talk2Tom11 is offline
Centurion
 
Join Date: Dec 2003
Location: Westchester, NY
Posts: 195
Question .txt file help


I want to open a .txt file and just get the number of lines that it contains.
Not the specific information within the lines. But just a line count. How would i go about that?
__________________
Ever wonder about those people who spend $2.00 a piece on those little bottles of Evian water? Try spelling Evian backwards: NAIVE.
Reply With Quote
  #2  
Old 09-14-2005, 02:07 PM
wayneph's Avatar
wayneph.txt file help wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

1 possibility:
Open the file, and read the contents into a string.
Split the String at CarriageReturnLineFeed.
See how many elements are in your array.
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
  #3  
Old 09-14-2005, 06:00 PM
jo0ls.txt file help jo0ls is offline
Senior Contributor

Forum Leader
* Expert *
 
Join Date: Feb 2005
Location: London
Posts: 1,050
Default

Look at the streamreader example for reading text files in the msdn.

Count the number of times the do ... loop runs (which is the number of readlines that return a string, and so the number of lines)
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
.txt file help
.txt file help
.txt file help .txt file help
.txt file help
.txt file help
.txt file help .txt file help .txt file help .txt file help .txt file help .txt file help .txt file help
.txt file help
.txt file help
 
.txt file help
.txt file help
 
-->