PDA

View Full Version : [VB] Read a specific line from txt file



unchew
May 2nd, 2006, 09:10 PM
I am trying to import some text from a .txt file and then be able to retrieve specific lines as strings. I have managed to open the text file using a StreamReader Object and thats it. I have no idea how to tell VB to extract certain lines I want. Any idea how this is done?

Here is my code at present:



Dim oStreamRead As IO.StreamReader
oStreamRead = New IO.StreamReader(Application.StartupPath + "\espanol.txt")


I really need this done, please help.

Thanks.

bwh2
May 3rd, 2006, 01:32 AM
i don't know VB, but here's how i would approach it in theory:

set a rowNum variable to 0. then as you go through the StreamReader, rowNum++. when rowNum gets to the line you want, throw those into another variable or array.