Help translating into -- 2 lines of code -- 500pts

Posted on 2006-03-25
Last Modified: 2010-04-23
string return_val = new string((char)10,1);//converts ascii characters.
          string hardReturn = new string((char)13,1); //converts ascii characters.

I came across this code and would like an equivalent for and something that is valid!  Thanks
Question by:rodmjay
    LVL 85

    Expert Comment

    by:Mike Tomlinson
    The code is making string "constants" for CarriageReturn(Cr) and LineFeed(Lf).

    You can just use the built-in VB constants:

    or the two together:

    LVL 85

    Expert Comment

    by:Mike Tomlinson
    Instead of vbCrLf, you can also use:
    LVL 6

    Expert Comment


    VbNewLine Still Work 2
    LVL 8

    Author Comment

    If you could just translate what those two strings would be that would be great
    LVL 34

    Accepted Solution

    These are the most direct equivalents

            Dim return_val As String = Chr(10) 'converts ascii characters.
            Dim hardreturn As String = Chr(13) 'converts ascii characters

    And this tests them

            MsgBox("a" & return_val & hardreturn & "b")


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now