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
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.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
"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 !