By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,567 Members | 1,522 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,567 IT Pros & Developers. It's quick & easy.

How to Line Break

P: n/a
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
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
example:

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

I think you are looking for the constant vbCrLf

:)
"Radith Silva" <ra****@xtra.co.nz> wrote in message
news:e6**************@TK2MSFTNGP09.phx.gbl...
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
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #2

P: n/a
Radith Silva wrote:
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")

--
Sven Groot

http://unforgiven.bloghorn.com
Nov 20 '05 #3

P: n/a
Hi Sven,
The best way to go in VB.NET is ControlChars.NewLine:
MessageBox.Show("Hello" & ControlChars.NewLine & "World")


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
Nov 20 '05 #4

P: n/a
* "Sven Groot" <sv*******@gmx.net> scripsit:
Radith Silva wrote:
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.


Or 'vbNewLine' which will work on the Mac too.
It don't work...Plz Help


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

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #5

P: n/a
Cor Ligthert wrote:
Hi Sven,
The best way to go in VB.NET is ControlChars.NewLine:
MessageBox.Show("Hello" & ControlChars.NewLine & "World")


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


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

--
Sven Groot

http://unforgiven.bloghorn.com
Nov 20 '05 #6

P: n/a
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
Nov 20 '05 #7

P: n/a
* "Cor Ligthert" <no**********@planet.nl> scripsit:
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).

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #8

P: n/a
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
Nov 20 '05 #9

P: n/a
* "Cor Ligthert" <no**********@planet.nl> scripsit:
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.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #10

P: n/a
LOL

And I am on the side of Armin in this.


... and I am on my side.

Nov 20 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.