Results 1 to 3 of 3

Thread: Multiple lines of text in a textbox

  1. #1
    Guest
    I am working on a project right now for school, which is a periodic table. When soemone clicks on an element (command button) I want it to put certain information in a text box on another form. If they click another element, the information in the text box is kept, and the information from the 2nd element is added. I can figure out how do do that. I just dont know how to put information on multiple lines. ex: (code is put in to preserve formatting)
    Code:
    ___Per. Table__  _____Text Box__________________
    He is clicked -> |Element name (line one)       |
                     |Atomic Number (line two)      |
                     |Atomic weight (line three) etc|
                     --------------------------------

  2. #2
    Fanatic Member Dim's Avatar
    Join Date
    Jul 2000
    Posts
    620
    Code:
    Public Sub Command1_Click()
      Form2.Text1.Text = Form2.Text1.Text & "This is element 1"
    End Sub
    
    Public Sub Command2_Click()
      Form2.Text1.Text = Form2.TExt1.Text & VbCrLf & "This Is Element 2"
    End Sub
    'And so on.
    'VbCrLf will place the text on a new line. If you want to preserve format, then i would 1) suggest using a RichTextBox or 2) send vbTAB to move the text around a bit.
    Hope that helps,
    D!m

    [Edited by Dim on 09-21-2000 at 05:33 PM]
    Dim

  3. #3
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    set the textbox's multiline property to True and change the code to this
    Code:
    Public Sub Command1_Click()
      Form2.Text1.Text = Form2.Text1.Text & VbCrLf & "This is element 1" & VBCR
    End Sub
    
    Public Sub Command2_Click()
      Form2.Text1.Text = Form2.TExt1.Text & VbCrLf & "This Is Element 2" & VBCR
    End Sub

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