Results 1 to 3 of 3

Thread: RichTextBox Text Insertion Problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2005
    Posts
    10

    RichTextBox Text Insertion Problem

    hello guys... i have an output error everytime i try to insert text into the rich text box.. here's my code:

    Code:
    with Richtextbox
     .seltext = "// A sample comment"
     .seltext = "// another sample comment"
    end with
    well with regards to the output... here is the supposed output of this code..


    // A sample comment
    // another sample comment


    well... with this code that i provided.. here is the output

    // A sample comment // another sample comment...

    - the text was inserted in one line.. instead the " //another sample comment" should be in the next line...

    How can i put the "//another sample comment" in the next line of the RTB Control??



    thanks...

  2. #2
    Member nf_vb's Avatar
    Join Date
    Mar 2007
    Location
    Portugal
    Posts
    35

    Re: RichTextBox Text Insertion Problem

    I am not sure one is what you need but....

    try this

    Private Sub Form_Load()
    With RichTextBox1
    .SelText = "A sample comment" & Chr(13) & "another sample comment"
    End With
    End Sub

  3. #3
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Brooklyn NY USA
    Posts
    1,258

    Re: RichTextBox Text Insertion Problem

    Seltext just continued where it is up too. it doesn't put in a new line. To add a new line you have to do it yourself. Like the code posted by nf_vb.

    with Richtextbox
    .seltext = "// A sample comment"
    .SelText = vbnewline
    .seltext = "// another sample comment"
    end with

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