?
Solved

Streamreader to read specific line

Posted on 2011-10-21
4
Medium Priority
?
284 Views
Last Modified: 2012-05-12
Hi,
I am using visual studio 2005.How to use stream reader to read specific line number in a text?

Cheers
0
Comment
Question by:RIAS
  • 2
4 Comments
 
LVL 17

Expert Comment

by:sonawanekiran
ID: 37005593
0
 
LVL 18

Accepted Solution

by:
Cluskitt earned 1000 total points
ID: 37005685
I just use a loop and dump the lines into a variable (an array if you want them all, a string if you just want the last one).

For a = 0 To 4
  sTemp = oRead.ReadLine
Next
0
 

Author Comment

by:RIAS
ID: 37006238
StreamReader.BaseStream Property?
0
 
LVL 18

Expert Comment

by:Cluskitt
ID: 37006307
No. Just declare your streamreader and a string:

Dim oRead As New IO.StreamReader(FileName)
Dim sTemp As String

Then use the loop above to read the 5th line. Change the value to read whichever line you wish to read.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question