How to Line Break

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Radith Silva

    How to Line Break

    In the following code all I want to do is to break a line (an enter in
    ms word) between each of the variables countOrders, stageTax, stageOne.
    I think in vb 6.0 all you have to do is "....." &_ "this will be on a
    new line"

    It don't work...Plz Help

    Private Sub cmdSummary_Clic k(ByVal sender As Object, ByVal e As
    System.EventArg s) Handles cmdSummary.Clic k

    MessageBox.Show ("Here is your Order:" & countOrders & "Orders" &
    FormatCurrency( stageTax) & "Total Tax" & FormatCurrency( stageOne) &
    "Total Due", "R'nR - Enjoy", MessageBoxButto ns.OK)
    End Sub


    It all comes in one line and when i go &_ that returns an error

    All replies welcome. Thanx
    Radith


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
  • Tarren

    #2
    Re: How to Line Break

    example:

    dim sOut as string
    sOut = "line1" & vbcrlf & "line2"

    I think you are looking for the constant vbCrLf

    :)


    "Radith Silva" <radith@xtra.co .nz> wrote in message
    news:e6GNvwSPEH A.1644@TK2MSFTN GP09.phx.gbl...[color=blue]
    > In the following code all I want to do is to break a line (an enter in
    > ms word) between each of the variables countOrders, stageTax, stageOne.
    > I think in vb 6.0 all you have to do is "....." &_ "this will be on a
    > new line"
    >
    > It don't work...Plz Help
    >
    > Private Sub cmdSummary_Clic k(ByVal sender As Object, ByVal e As
    > System.EventArg s) Handles cmdSummary.Clic k
    >
    > MessageBox.Show ("Here is your Order:" & countOrders & "Orders" &
    > FormatCurrency( stageTax) & "Total Tax" & FormatCurrency( stageOne) &
    > "Total Due", "R'nR - Enjoy", MessageBoxButto ns.OK)
    > End Sub
    >
    >
    > It all comes in one line and when i go &_ that returns an error
    >
    > All replies welcome. Thanx
    > Radith
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it![/color]


    Comment

    • Sven Groot

      #3
      Re: How to Line Break

      Radith Silva wrote:[color=blue]
      > In the following code all I want to do is to break a line (an enter in
      > ms word) between each of the variables countOrders, stageTax,
      > stageOne. I think in vb 6.0 all you have to do is "....." &_ "this
      > will be on a new line"[/color]

      No, in VB6 you must use vbCrLf.
      [color=blue]
      > It don't work...Plz Help[/color]

      The best way to go in VB.NET is ControlChars.Ne wLine:
      MessageBox.Show ("Hello" & ControlChars.Ne wLine & "World")

      --
      Sven Groot


      Comment

      • Cor Ligthert

        #4
        Re: How to Line Break

        Hi Sven,
        [color=blue][color=green]
        >>The best way to go in VB.NET is ControlChars.Ne wLine:
        >>MessageBox.Sh ow("Hello" & ControlChars.Ne wLine & "World")[/color][/color]

        Can you explain why this is "The best way".

        And stating with that other methods are wrong, I completly disagree this
        with you because this can be *a good way*, however not always *the best way*
        in my opinion.

        Cor


        Comment

        • Herfried K. Wagner [MVP]

          #5
          Re: How to Line Break

          * "Sven Groot" <sveng3000@gmx. net> scripsit:[color=blue]
          > Radith Silva wrote:[color=green]
          >> In the following code all I want to do is to break a line (an enter in
          >> ms word) between each of the variables countOrders, stageTax,
          >> stageOne. I think in vb 6.0 all you have to do is "....." &_ "this
          >> will be on a new line"[/color]
          >
          > No, in VB6 you must use vbCrLf.[/color]

          Or 'vbNewLine' which will work on the Mac too.
          [color=blue][color=green]
          >> It don't work...Plz Help[/color]
          >
          > The best way to go in VB.NET is ControlChars.Ne wLine:
          > MessageBox.Show ("Hello" & ControlChars.Ne wLine & "World")[/color]

          I prefer 'ControlChars.N ewLine' in VB.NET too, but I use 'MsgBox'
          instead of 'MessageBox.Sho w'. It's the "VB way".

          --
          Herfried K. Wagner [MVP]
          <URL:http://dotnet.mvps.org/>

          Comment

          • Sven Groot

            #6
            Re: How to Line Break

            Cor Ligthert wrote:[color=blue]
            > Hi Sven,
            >[color=green][color=darkred]
            >>> The best way to go in VB.NET is ControlChars.Ne wLine:
            >>> MessageBox.Show ("Hello" & ControlChars.Ne wLine & "World")[/color][/color]
            >
            > Can you explain why this is "The best way".[/color]

            Because it also works on systems where a NewLine is not CrLf.

            --
            Sven Groot


            Comment

            • Cor Ligthert

              #7
              Re: How to Line Break

              Hi Sven,

              Have a look at this thread,



              I am almost not involved this thread, however that is more because my
              opinion is almost the same as Armin in this.

              However when you see all those ideas, I stay with my previous message that
              it can be a good method, however not the *best* (where I do not give an
              alternative best).

              Cor


              Comment

              • Herfried K. Wagner [MVP]

                #8
                Re: How to Line Break

                * "Cor Ligthert" <notfirstname@p lanet.nl> scripsit:[color=blue]
                > Have a look at this thread,
                >
                > http://tinyurl.com/2lu35
                >
                > I am almost not involved this thread, however that is more because my
                > opinion is almost the same as Armin in this.
                >
                > However when you see all those ideas, I stay with my previous message that
                > it can be a good method, however not the *best* (where I do not give an
                > alternative best).[/color]

                IMO, for a messagebox, console etc. /always/ the 'NewLine' properties
                are the best ('Environment.N ewLine', 'ControlChars.N ewLine',
                'vbNewLine') because they do not explicitly state their value. I prefer
                'ControlChars.N ewLine' because it's the "VB way" to get this constant
                and I do not like the 'vb*' constants (they are not an enum so they are
                sometimes hard to remember).

                --
                Herfried K. Wagner [MVP]
                <URL:http://dotnet.mvps.org/>

                Comment

                • Cor Ligthert

                  #9
                  Re: How to Line Break

                  See the link to the thread I provided, there is all this discussion already
                  in.

                  And I am on the side of Armin in this.

                  Cor


                  Comment

                  • Herfried K. Wagner [MVP]

                    #10
                    Re: How to Line Break

                    * "Cor Ligthert" <notfirstname@p lanet.nl> scripsit:[color=blue]
                    > See the link to the thread I provided, there is all this discussion already
                    > in.
                    >
                    > And I am on the side of Armin in this.[/color]

                    .... and I am on my side.

                    --
                    Herfried K. Wagner [MVP]
                    <URL:http://dotnet.mvps.org/>

                    Comment

                    • Cor Ligthert

                      #11
                      OT

                      LOL[color=blue][color=green]
                      > >
                      > > And I am on the side of Armin in this.[/color]
                      >
                      > ... and I am on my side.
                      >[/color]


                      Comment

                      Working...