By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,986 Members | 1,487 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,986 IT Pros & Developers. It's quick & easy.

multiline database field causing chaos!

P: 43
I'm using a comma delimited file to show data from a database in microsoft excel, it all works fine and dandy, apart from one column.

The data it is returning from this column, is for each person, emails and notes (yes i know its not a very good way of doing things), but i'm stuck with it.

this column could contain an email copied from outlook, with lots of new lines etc..

my question/problem is, - when its been taken from a database and put into visual studio 2005 (vb)

it would be in the form of a multiline database cell converted to a string, which means this string will contain new lines, and all sorts of stuff. I want to change this multi line string into a single line string, without losing any data.


"Hello Dude
How are you?




"Hello Dude How are you? Wow Regards Me" - a single line string, WITHOUT all any new lines that would appear from copying an email from outlook or pressing enter

any help or code would be really great

Thanks alot guys
Dec 20 '07 #1
Share this Question
Share on Google+
2 Replies

Expert 100+
P: 1,445

Say Your String Is in Variable TempStr..

Expand|Select|Wrap|Line Numbers
  1. Dim MyString as string 
  2. MyString = TempStr
  3. MyString = MyString.Replace (vbCrLF, "")
  4. MyString = MyString.Replace (vbLF, "")
  5. MyString = MyString.Replace (vbCr, "")
Takes Care of all the Line Break Characters..

Dec 20 '07 #2

P: 43
wow that worked great!

thanks again!

Dec 20 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.