Read just the first line of a txt file or variable text from read PDF


#1

Hello,

I am trying to reproduce this with invoke method.

the invoke method states that there is no method for system.IO.StreamReader.

also tried with

arrLines = Split(entirePDF,Environment.NewLine) – this one just throws 1 letter if I output as

arrlines.tostring(0)

I also tried

pdfText.ToString.Split("\n") but cannot assign char to string :frowning:

can anyone help me pls,


#2

Hi,

The Split function should work for what you are describing. I think you need (0) next to the character.

Split(entirePDF,Environment.NewLine(0))(0)
or
entirePDF.Split(Environment.NewLine(0))(0)

There are a couple ways to do that though.

Hope that helps solve it.

Thanks.


#3

Great, that’s the solution… thanks a lot :slight_smile: :pizza:


#4

this worked for me - it returned the second line from a text file
I read the my entire text file into varTemp
and then I wanted to extract the various lines

varTemp.Split(Environment.NewLine(0))(1)

this returned the second line

thank you ClaytonM & beesheept