Add separation line between concatenated strings in VB.net

I am trying to combine the output of various functions into a text box, but it all happens on the same biiig line. How to insert break lines between variables? I have something like this:

Me.TextBox.text = output1 + output2

And I would like to have something like this:

Me.TextBox.text = output1 + ENTER + output2

Any ideas?

Thanks!

+5
source share
3 answers

Environment.NewLinea read-only variable is what you want to use. There also vbCrLf, but it is for obsolete purposes and is independent of the environment.

Try the following:

Me.TextBox.Text = output1 + Environment.NewLine + output2
+11
source
Me.TextBox.text = output1 & Environment.NewLine & output2

Also use vb.net for concat strings, + - deprecated support

+5
source

Environment.NewLine is usually the preferred method. It will result in a carriage return and line for Windows systems and a linear channel for Unix systems only ...

http://msdn.microsoft.com/en-us/library/system.environment.newline.aspx

Also note that you can use vbCrLf from the Microsoft.VisualBasic namespace, which will always return a carriage return and a line together.

+1
source

All Articles