Community discussion forum

Changing colour of certain text.

Tags: vb6 Australia
  • 2 years ago
    I just wanna know if this is possible, not how to do it. Is it possible that I can make it so all text between (and) appears a different colour or style?


    Thanks,

    BP
  • 2 years ago

    Where is this text at?

    In a richtext control? Yes

     

  • 2 years ago
    Yeah, rich text box. Thanks, BP
  • 2 years ago
    What is the class for changing colour? There is no forecolor id for Richtext..

    Thanks,

    BP
  • 2 years ago

    You would have to first select the text then change the color...

    'This would change all text to red in rtf

    rtf.SelStart = 0
    rtf.SelLength = Len(rtf.Text)
    rtf.SelColor = vbRed

  • 2 years ago
    I am using:
    If txtData.SelLength = Len(txtData.Text) Then CommonDialog1.ShowColor Else MsgBox "You need to select text" End If
    But you always get the message box, unless you have selected ALL of the text. How do I do it so you set it only the highlighted text, and still have the message box show if you dn't have any text selected. BP
  • 2 years ago
    try **txtData.SelLength > 0**

  • 2 years ago

    b3ginn3r is right......

    If txtData.SelLength > 0 Then
        CommonDialog1.ShowColor
    Else
        MsgBox "You need to select text"
    End If





  • 2 years ago
    Righteo.

    Thank you both :)

Post a reply

Enter your message below

Sign in or Join us (it's free).

Want to stay in touch with what's going on? Follow us on twitter!