Solved

RichTextBox 6.0 won't display my formatting

Posted on 2006-11-15
6
333 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
ID: 17949172
This works for me

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

Author Comment

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

Author Comment

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

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
ID: 17949612
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
ID: 17988446
PAQd, 125 points refunded.

DarthMod
CS Moderator
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Determine Range to Select 5 55
Sending a email via excel using vba 6 109
Access 2013 combo box not working 3 58
Modifying Conditional Format from VBA code 3 69
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

685 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