CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2001
    Location
    Israel
    Posts
    127

    changing the color of known words

    hello all

    I wanted to know, how to change the color of certain words in a rich text-box when a the user finishes to type the word (as in the VB editot where words like "end sub" are colored)

    pleeease help

    Meir


  2. #2
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868

    Re: changing the color of known words

    You'll have to write code to find the words who's color you want to change, set the selStart and selLength properties so that this text is selected and then use the SelColor property... similar to...


    private Sub Test()
    RichTextBox1.SelStart = 1
    RichTextBox1.SelLength = 10
    RichTextBox1.SelColor = vbRed
    end sub





  3. #3
    Join Date
    Nov 2001
    Location
    dull office, Sydney, NSW,Australia
    Posts
    85

    Re: changing the color of known words

    Trouble with this is that it highlights the word and if you immediately set the the sellength back to zero it will flicker.
    Is there a more direct method, like using SendMessage(..) based on the current cursor location in the Richtextbox, that does not involve selecting the word ?

    I can only please one person per day. Today is not your day. Tomorrow is not looking good either.

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

Featured