Carriage return

  • Thread starter Thread starter Nathan
  • Start date Start date
N

Nathan

How do you code a carriage return in a textbox? For example,

Txtbox1.Text = "My address:" & ?CarriageReturn? & "555 Maple" &
?CarriageReturn? & "Somewhere, USA"

so that the textbox shows the following:

My address:
555 Maple
Somewhere, USA
 
Nathan said:
How do you code a carriage return in a textbox? For example,

Txtbox1.Text = "My address:" & ?CarriageReturn? & "555 Maple" &
?CarriageReturn? & "Somewhere, USA"

so that the textbox shows the following:

My address:
555 Maple
Somewhere, USA

- System.Environment.NewLine
- Microsoft.VisualBasic.Constants.vbNewLine
- Microsoft.VisualBasic.Constants.vbCrLf
- Microsoft.VisualBasic.ControlChars.NewLine
- Microsoft.VisualBasic.ControlChars.CrLf

Also set textbox1.multiline = true
 
Firstly set the textbox to be multiline... then just + or &
ControlChars.CRLF

as in Txtbox1.Text = "My address:" & ControlChars.CRLF & "555 Maple" &
 
In addition to the other posts, you can use Environment.NewLine which is a
platform agnostic way of doing it (not that you'll be running .NET on Unix
anytime soon, but it's worth mentioning).

Cheers,

Bill
 
* "Nathan said:
How do you code a carriage return in a textbox? For example,

Txtbox1.Text = "My address:" & ?CarriageReturn? & "555 Maple" &
?CarriageReturn? & "Somewhere, USA"

so that the textbox shows the following:

Add a 'ControlChars.NewLine' or 'Environment.NewLine' to the string.
 
Back
Top