Hi all,

I am stuck on what 'should' be a fairly simple thing to solve, however after a good search i haven't got very far.

Basically i am pulling data from a database which might have multiple lines of data, however for one particular task i only want to grab the first line of text (as a sort of preview).

I.e:
This is a sample sentence with
multiple
lines

I would only want to get the bit saying "This is a sample sentence with". How could i go about doing this? I have tried the 'trim' function but that didn't quite do what i was hoping for.

Thanks in advance for any input! :S

Recommended Answers

All 2 Replies

you could place that into a String variable, then use myVar.Split(vbCrLf) . That would create a String() array, and "This is a sample sentence" would be element 0 of the array.

commented: Brilliant and easy method! +2

Thanks Alc! I don't know why i didn't think of that method... It's now working! :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.