Results 1 to 8 of 8

Thread: [RESOLVED] Append on textbox?

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2006
    Posts
    61

    Resolved [RESOLVED] Append on textbox?

    How can i append some strings on an textbox?
    More than than how can i do that by starting at the next line? Is there a carriage return character that i can append as well? Is that the char(13)?
    example
    if my text box has contents
    "hallo"
    i want to code it so it says
    "hallo
    world"

    Any ideas?
    Thnx

  2. #2
    Fanatic Member
    Join Date
    Aug 2006
    Location
    Chicago, IL
    Posts
    514

    Re: Append on textbox?

    VB Code:
    1. Me.TextBox1.Text = Me.TextBox1.Text & Microsoft.VisualBasic.vbCrLf & "World"
    Warren Ayen
    Senior C# Developer
    DLS Software Studios (http://www.dlssoftwarestudios.com/)

    I use Microsoft Visual Studio 2005, 2008, working with Visual Basic and Visual C#
    Hey! If you like my post, or I solve your issue, please Rate Me!

  3. #3
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: Append on textbox?

    VB Code:
    1. TextBox1.AppendText(Environment.NewLine & "World")
    2.  
    3. 'TextBox1.Text = TextBox1.Text & ControlChars.NewLine & "Another way of appending text and [Enter] key to textbox"

    Edit: And make sure that the Multiline property of textbox is set to True.
    Last edited by Harsh Gupta; Oct 27th, 2006 at 04:57 PM.
    Show Appreciation. Rate Posts.

  4. #4
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: Append on textbox?

    to append text simply use:
    TextBox1.AppendText("Additional text here")
    or
    TextBox1.Text &= "Additional text here"
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  5. #5

    Thread Starter
    Member
    Join Date
    Jun 2006
    Posts
    61

    Re: Append on textbox?

    Thanks everybody. Didnt mention that i am programmin on the compact framework, hence neither the AppendText exists nor the Enviroment.Newline.
    However solved the problem by writing
    TextBox1.text = TextBox1.Text & vbnewline & "New text"
    Thanks again

  6. #6
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,104

    Re: Append on textbox?

    You will get some tiny improvement by changing that solution to:

    textbox1.text &= vbNewLine & 'new text'
    My usual boring signature: Nothing

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Append on textbox?

    Argh! This is a duplicate thread.

    http://www.vbforums.com/showthread.php?t=435203

    One thread per topic and one topic per thread please.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  8. #8
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,104

    Re: Append on textbox?

    Actually, the topic is only closely related. That other thread appears to be a superset of the current thread. However, the current thread should be marked as resolved.
    My usual boring signature: Nothing

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