Results 1 to 5 of 5

Thread: Text color changing

  1. #1

    Thread Starter
    Lively Member GoldEagle's Avatar
    Join Date
    Feb 2006
    Location
    Canada
    Posts
    82

    Text color changing

    I have a strings that are in a RTB. I would like them highlighted in a blue color when the user presses a command button leaving all other text black. What code would I use to do this?
    If you found my post in anyway helpful please rate it.

  2. #2
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Text color changing

    you need to select the text and then set its colour:
    VB Code:
    1. Private Sub Command1_Click()
    2.     With RichTextBox1
    3.         .SelStart = 5 ' start of selection
    4.         .SelLength = 10 ' length of selection
    5.         .SelColor = vbBlue
    6.     End With
    7. End Sub

  3. #3

  4. #4

    Thread Starter
    Lively Member GoldEagle's Avatar
    Join Date
    Feb 2006
    Location
    Canada
    Posts
    82

    Re: Text color changing

    Actually I meant that I had a list of strings that I want to change colours if they appear in a RTB, when the user presses a command button.
    If you found my post in anyway helpful please rate it.

  5. #5

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