Richtext box changing colours

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mague
    New Member
    • May 2007
    • 137

    Richtext box changing colours

    Hey,

    I need to change colours in a richtextbox. I am making a simple html editor. i want to make the tags different colours. I have searched google so please dont say search google. I also use vb.net which makes it a bit harder to find anything

    Open to any ideas but searching google.

    ty
    Mague

    ps. Im a kid (13) Not to technicle thanks
  • Mague
    New Member
    • May 2007
    • 137

    #2
    I figured it out with this code

    Code:
                   RichTextBox1.SelectionStart = RichTextBox1.Find("<html>")
            'using the Find method to find the text "are" and setting it's return
            'property to SelectionStart which selects the text 
            RichTextBox1.SelectionColor = Color.Blue
            'setting the color for the selected text with SelectionColor property
            RichTextBox1.SelectionStart = RichTextBox1.Find("<body>")
            RichTextBox1.SelectionColor = Color.Yellow
    i have tried but i cannot make it select the text that the user was previeously on

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Glad to see you got it sorted out. See, being 13 is no handicap. You were much too quick for us. :)

      Comment

      • Mague
        New Member
        • May 2007
        • 137

        #4
        I just relized a problem. Everytime text is put into the richtextbox it has to go through a few tags. And if you writing html codes it get really really really anoying. Is there anyway that i can make it only update things that have not been updated. (Meaning change the colours only if the colour hasnt been changed)

        Also it is a bit of a handycap because you cannot buy software or anything :)

        ty alot
        mague

        Comment

        Working...