RichTextBox 6.0 won't display my formatting

Posted on 2006-11-15
Medium Priority
Last Modified: 2013-12-26
I'm not adding an editor to my program, or allowing the user to enter any text at all. All I want to do is display some premade RTF Help files in RichTextBoxes when the program loads.

I have added the Microsoft RichTextBox 6.0 Control to my program... I added a RichTextBox to my form and then I tried out a line from a tutorial I found:

    Dim sRTF As String
    sRTF = “{{\colortbl;\red255\green0\blue0;} Visual {\cf1 Basic} Rules!}”
    RichTextBox1.TextRTF = sRTF

But when my form loads the word "Basic" is not red.

I also tried making an RTF file with a variety of formatting options, saved it, then ran the line:

    RichTextBox1.LoadFile "C:\test.rtf", 0

But when it loads up, everything is plain text except for the bullet points, those seem to come through fine, but nothing is Bold, Underlined, different font size, or different colors.

I can go in after the fact and apply formatting to the text in the RTF box, but if I premake a file and try to load it in, the bullet points are the only thing it recognizes.

I don't understand what I might be doing wrong here. I assumed the simple line from the tutorial would at least work where my more involved files failed, but I can't even get that to display properly.

Any ideas what I might be doing wrong here?
Question by:kkonkle
  • 2
  • 2
LVL 20

Expert Comment

ID: 17949172
This works for me

sRTF = "{{\colortbl;\red255\green0\blue0;} Visual {\cf1 Basic} Rules!}"
(double quotes on each end)

Author Comment

ID: 17949399
Sorry, I'm not sure what those are in my post above, but they should be double quotes.

The line you supplied is exactly what I have in my program, yet it does not display properly.

I should add, if I make a new project, and use either method as above, it works great, all formatting comes through.  If I do everything exactly the same in my existing program, only the bullet points are displayed properly.

In the existing project the RichTextBox exists inside an SStab control, which is on a child form embedded into an MDIform.  I wouldn't think the controls containing the RichTextBox would matter, but for all I know they might.

Let me know what else you need to know about the existing project I'm trying to insert this into.

Author Comment

ID: 17949544
OK, lately it seems like I always spend my points on questions and then figure them out myself.  

So here's the scoop on this one.

Right now my program starts up and runs things in this order:

   End Child1_Load
   End Child2_Load


   End Child9_Load

End MDIform_Load

Previously, I was putting the RichTextBox code within the Child2_Load section, where the AAA appears above... apparently VB doesn't like this.  When I move the exact same code to where the BBB is, at the very end of the MIDform_Load event, the formatting comes through just fine.  

So that's the answer.  I guess I'd like to request my points back.
LVL 20

Expert Comment

ID: 17949612
Post a new question at
Stating you have solved the question yourself,
with a link back to this question, a moderator will take care of that for you.

Accepted Solution

DarthMod earned 0 total points
ID: 17988446
PAQd, 125 points refunded.

CS Moderator

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question