multiline database field causing chaos!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pieandpeas
    New Member
    • Sep 2007
    • 43

    #1

    multiline database field causing chaos!

    Hi,
    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.

    e.g


    "Hello Dude
    How are you?

    Wow

    regards
    Me"

    to

    "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
  • QVeen72
    Recognized Expert Top Contributor
    • Oct 2006
    • 1445

    #2
    Hi,

    Say Your String Is in Variable TempStr..

    [code=vbnet]
    Dim MyString as string
    MyString = TempStr
    MyString = MyString.Replac e (vbCrLF, "")
    MyString = MyString.Replac e (vbLF, "")
    MyString = MyString.Replac e (vbCr, "")
    [/code]

    Takes Care of all the Line Break Characters..

    Regards
    Veena

    Comment

    • pieandpeas
      New Member
      • Sep 2007
      • 43

      #3
      wow that worked great!

      thanks again!

      :-D

      Comment

      Working...