CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 1999
    Location
    Oklahoma
    Posts
    263

    CStrings & Edit Boxes

    I am trying to put together 2 CStrings, display them in an edit box, and have a carriage return/line feed <CRLF> between each string. So far all of my attempts have failed miserably. This is what I am doing:

    CString string1 = "This is string 1.\n ";
    CString string2 = "This is string 2.";

    m_string3 = string1 + string2;

    UpdateData...

    What I want displayed in the edit box is:

    This is string 1.
    This is string 2.

    What I get is "This is string1.| This is string2." The | is a real dark black line. The strings are put together but I don't get the <crlf> like I want. Any suggestions? I know this has to be easier than it is.

    Thanks in advance!

    John Hagen





  2. #2
    Join Date
    Apr 1999
    Posts
    23

    Re: CStrings & Edit Boxes

    Hi,

    I think you forgotten the CR in the CRLF.
    CRLF consists of "\r\n" and not "\n" alone.

    Hope that helps.
    Chao


  3. #3
    Join Date
    May 1999
    Location
    Oklahoma
    Posts
    263

    Re: CStrings & Edit Boxes

    Yes, that was my problem. Beginners ignorance gets me every time. Thank you for replying and pointing out the errors of my ways.

    John Hagen



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured