How to Line Break

R

Radith Silva

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_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles cmdSummary.Click

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


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

All replies welcome. Thanx
Radith
 
T

Tarren

example:

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

I think you are looking for the constant vbCrLf

:)
 
S

Sven Groot

Radith said:
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"

No, in VB6 you must use vbCrLf.
It don't work...Plz Help

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

Cor Ligthert

Hi Sven,

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
 
H

Herfried K. Wagner [MVP]

* "Sven Groot said:
No, in VB6 you must use vbCrLf.

Or 'vbNewLine' which will work on the Mac too.
The best way to go in VB.NET is ControlChars.NewLine:
MessageBox.Show("Hello" & ControlChars.NewLine & "World")

I prefer 'ControlChars.NewLine' in VB.NET too, but I use 'MsgBox'
instead of 'MessageBox.Show'. It's the "VB way".
 
C

Cor Ligthert

Hi Sven,

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).

Cor
 
H

Herfried K. Wagner [MVP]

* "Cor Ligthert said:
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).

IMO, for a messagebox, console etc. /always/ the 'NewLine' properties
are the best ('Environment.NewLine', 'ControlChars.NewLine',
'vbNewLine') because they do not explicitly state their value. I prefer
'ControlChars.NewLine' 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).
 
C

Cor Ligthert

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
 
H

Herfried K. Wagner [MVP]

* "Cor Ligthert said:
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.

.... and I am on my side.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top