Results 1 to 4 of 4

Thread: [RESOLVED] rich text box change font color

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2006
    Posts
    59

    Resolved [RESOLVED] rich text box change font color

    I have a sub that reads in and changes the selcolor of a rich text box.

    The code executes fine and if i run the code and then write in the rich text box the text is the color set by the selcolor but if i click on a button i have set up that simply enters some text into the rich text box the text color stays black (its original color)

    what do i need to do to get the text to change to the set color when it is entered like it does when its written in.

  2. #2
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: rich text box change font color

    By using .SelColor u are setting color at a current char (you get that from .SelStart). If you continue to enter text the color should stay the same (until the next .SelColor statement). If you want to change the color at the end of the RTB, before continuing entering the text, you should first set the position:

    VB Code:
    1. RichTextBox1.SelStart = Len (RichTextBox1.Text)
    2. 'and then set the color...
    3. RichTextBox1.SelColor = vbBlue 'or something...

  3. #3
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: rich text box change font color

    Actually, this can be also used by most RichTextBox's .Sel statements (.SelFontName, .SelFontSize, .SelBold, .SelItalic, .SelUnderline...)

  4. #4

    Thread Starter
    Member
    Join Date
    Jun 2006
    Posts
    59

    Re: rich text box change font color

    Cheers gavio,

    i will use the .selstart and see how i get on. thanks again

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