Results 1 to 4 of 4

Thread: setting Textbox.Text with multiple lines

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Location
    Quebec, Canada
    Posts
    3
    It is very simple, I would like to add a line to a textbox that already contain lines.
    I supposed it would be
    Textbox.Text = "new line" & Chr(x) & Textbox.Text

    but I haven't found it yet

  2. #2
    Addicted Member curlywink's Avatar
    Join Date
    Mar 2000
    Location
    Manila, Philippines
    Posts
    141
    Hi there, try this.
    Textbox.Text = vbCR & vbLF & Chr(x) & Textbox.Text

    Hope this can help 'ya ...


  3. #3
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    try this:

    Code:
    Text1.Text = "Insertion Text" Chr(10) & Text1.Text
    Say if Text1 contains "Hello", and you run the above code it will become

    Insertion Text
    Hello

    ok

  4. #4
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    da_silvy is ALMOST right...

    Did you actually try your code, da_silvy?

    You need to add an ampersand (&) between "Insertion Text" and the newline character, and using Chr(10) won't work...it just puts a vertical bar in the text.

    Try this:
    Code:
    Text1.Text = "Insertion Text" & vbNewLine & Text1.Text
    These also work the same way:
    Code:
    Text1.Text = "Insertion Text" & vbCr & vbLf & Text1.Text
    
    '...or...
    
    Text1.Text = "Insertion Text" & vbCrLf & Text1.Text
    
    '...or...
    
    Text1.Text = "Insertion Text" & Chr(13) & Chr(10) & Text1.Text
    ~seaweed

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width