Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

How Do I Put An End Of Line Character In A TextBox

Discussion in 'Information Technology' started by Christopher Lusardi, Jul 28, 2006.

  1. Christopher Lusardi

    Christopher Lusardi
    Expand Collapse
    Guest

    With code such as the below how would I put an end of line character in
    the 2nd line of:

    Textbox1.Text = "Hello "
    Textbox1.Text =
    Textbox1.Text = "World"

    Thanks,
    Chris Lusardi
     
  2. Loading...


  3. Rick B

    Rick B
    Expand Collapse
    Guest

    Assuming you are trying to display data on more than one line, you'd do
    something like...

    = "This is line 1." & chr(13) & chr(10) & "This is line 2."


    --
    Rick B



    "Christopher Lusardi" <clusardi2k@aol.com> wrote in message
    news:1147799545.718019.114080@j33g2000cwa.googlegroups.com...
    > With code such as the below how would I put an end of line character in
    > the 2nd line of:
    >
    > Textbox1.Text = "Hello "
    > Textbox1.Text =
    > Textbox1.Text = "World"
    >
    > Thanks,
    > Chris Lusardi
    >
     
  4. Michael H

    Michael H
    Expand Collapse
    Guest

    Chris,

    Actually, after running the three lines of code below, your TextBox would
    only contain "World", as you are resetting the value each time.

    Here are some constants you might find useful:
    vbLF (Line Feed)
    vbCR (Carriage Return)
    vbCRLF (Carriage Return with Line Feed)

    You can use them like this:
    Textbox1.Text = "Hello " & vbCrLf & "World"

    Or like this (note that the new values are being Appended to the previous
    contents of the TextBox, not replacing the previous contents as your example
    was doing):
    Textbox1.Text = "Hello "
    Textbox1.Text = Textbox1.Text & vbCrLf
    Textbox1.Text = Textbox1.Text & "World"

    -Michael


    "Christopher Lusardi" wrote:

    > With code such as the below how would I put an end of line character in
    > the 2nd line of:
    >
    > Textbox1.Text = "Hello "
    > Textbox1.Text =
    > Textbox1.Text = "World"
    >
    > Thanks,
    > Chris Lusardi
    >
    >
     

Share This Page