954,517 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to reconise newlines in VB.NET

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

a_salted_peanut
Newbie Poster
12 posts since Apr 2009
Reputation Points: 10
Solved Threads: 1
 

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.

alc6379
Cookie... That's it
Team Colleague
2,820 posts since Dec 2003
Reputation Points: 186
Solved Threads: 147
 

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

a_salted_peanut
Newbie Poster
12 posts since Apr 2009
Reputation Points: 10
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You