Results 1 to 3 of 3

Thread: Multiline Textbox?

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2007
    Posts
    39

    Multiline Textbox?

    i have a textbox
    i have another textbox
    i have a button

    words go in the second textbox
    button is clicked
    they show up on first textbox

    if "badword" is typed
    all words go away

    Im good...

    what do i have to do to make the textbox jump to the nextline after every input...clicking of the button

    i thought i had to calculate the textline...not good idea
    i tried telling it to hit the enter button kind of like a macro but that went nowheere

    Code:
    Public Class Form1
        Private Sub Displaytextbutton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Displaytextbutton.Click
            DisplayBox.Text = DisplayBox.Text + Textinputbox.Text
    if textinputbox.text = ("badword") then
    displaybox.text = ("")
        End Sub
    End Class

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: Multiline Textbox?

    just add an environment.newline statement to the end of the text.. that will add a carriage return (same as pressing enter if the cursor was at the end of the current line of text)

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

    Re: Multiline Textbox?

    To clean up your code a bit and incorporate kleinma's suggestion:
    vb Code:
    1. Dim newText As String = Me.textInputBox.Text
    2.  
    3. If newText = "badword" Then
    4.     Me.displayBox.Clear()
    5. Else
    6.     Me.displayBox.AppendText(newText & Environment.NewLine)
    7. End If
    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

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