Solved

RichTextBox 6.0 won't display my formatting

Posted on 2006-11-15
6
329 Views
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?
0
Comment
Question by:kkonkle
  • 2
  • 2
6 Comments
 
LVL 20

Expert Comment

by:hes
Comment Utility
This works for me

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

Author Comment

by:kkonkle
Comment Utility
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.
0
 

Author Comment

by:kkonkle
Comment Utility
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:

MDIform_Load
   Child1_Load
      ...
   End Child1_Load
   Child2_Load
      AAA
   End Child2_Load

   ...

   Child9_Load
      ...
   End Child9_Load

   BBB
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.
0
 
LVL 20

Expert Comment

by:hes
Comment Utility
Post a new question at
http://www.experts-exchange.com/Community_Support/
Stating you have solved the question yourself,
with a link back to this question, a moderator will take care of that for you.
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
Comment Utility
PAQd, 125 points refunded.

DarthMod
CS Moderator
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now