Results 1 to 3 of 3

Thread: Rich text box

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2000
    Location
    Peterborough, Cambs, England
    Posts
    176

    Post

    Hi

    I know how to change the text colour in a rich text box, but how can I change the colour of individual lines of text when they are inserted?

    e.g.

    rtfOutput.Text = rtfOutput.Text & vbCrLf & "blah blah blah"

    How could I make it red for instance without making the text already in the rich text box red also?

    Thanks.

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Post

    Use the SelText property to insert text and SelColor to select colour.

    With RichTextBox1
    .SelStart = Len(.Text)
    .SelColor = vbRed
    .SelText = vbCrLf & "here's a new line."
    End With

    Good luck!

    ------------------
    Joacim Andersson
    [email protected]
    [email protected]
    www.YellowBlazer.com



  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2000
    Location
    Peterborough, Cambs, England
    Posts
    176

    Post

    Thanks! :-)

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