RichTextBox Control Setting Fonts - HELP HELP HELP !!!! 
Author Message
 RichTextBox Control Setting Fonts - HELP HELP HELP !!!!

I need some help on why the following VB stmns do not work in FormLoad event
when MORE THAN ONE setting for color is made on different portion of a text
string being displayed on the Form.

Enivronment: VB5, WindowsNT4, using Microsoft VB5's RichTextBox Control (named
RichTxtBox1)

Below is the VB text fragment:

++++++++++++++++++++++++++++++++++++++++++++++++++++++
Private Sub Form_Load()
    Set rtfText = RichTextBox1
    rtfText.TextRTF = "12345678901" & chr(10) 'chr10 is line feed
    rtfText.TextRTF = rtfText.Text & "Line2"

'A =   Following will work, text shows as Red in runtime mode
   rtfText.SelStart = 0
   rtfText.SelLength =4
   rtfText.SelColor = vbRed

'B = Following will work, PROVIDED I remove "A" stmn block
   rtfText.SelStart = 5
   rtfText.SelLength = 10
   rtfText.SelColor = vbBlue

'C = Following will work whether it is A or B being active
   rtfText.Font.Bold = True

End Sub

+++++++++++++++++++++++++++++++++++

"A" and "B" both work whenI put its stmns inside its respective button on the
Form and click each buttons in turn (after I manually selected the text).  

But I want to open up a form in runtime and have the text displaying text of
different colors automatically, without user selecting text and clicking
buttons to set color.  HOW DO I DO THIS ???  Why the FormLoad event cannot
handles more than one setting for font colors in the RichTextBox Control?

Can you help???  Thank you in advance !

Mary Walker



Sun, 29 Oct 2000 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. HELP HELP HELP Set document name of print job from VB HELP HELP HELP

2. help,help,help,help,help,help,help,help,help,help,help,help,help,

3. Help,Help,Help,Help,Help,Help,Help,Help,Help,Help,Help,Help,Help,Help,Help,Help,Help,Help,

4. Help, Help, Help, Help, Help, Help, Help, Help, Help, Help, Help, Help, Help, Help, Help, Help, Help,

5. HELP HELP HELP HELP HELP HELPHELP HELP HELPHELP HELP HELP

6. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

7. HELP HELP HELP, Need help, in IE Control

8. HELP HELP HELP HELP HELP HELP HELP HEL P HELP HE LP HELP HELP HEL P HELP HELP

9. Help Help Help Help Help Help !!!!!

10. HELP HELP HELP Early Binding Excel 5.0 HELP HELP HELP

11. Need help to set a system font

12. Help - I want the icon font in a list view to use the Windows setting

 

 
Powered by phpBB® Forum Software