• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 392
  • Last Modified:

RichTextBox displays #@$%*&(

Hi, I'm using a richtextbox to display a word doc that I'm using for help files in my database application.
I have tried to bring up the file as a txt file but it wont show the cross referencing for the links in the file, I tried it as a word doc and it shows it as a lot of gibberish, I've tried it sa a rtfFile but I get the same gibberish.
My form load code is
Private Sub Form_Load()
    Dim HelpFiles As Document
   
    'Call the word document to the rich text box
    rtfHelpFiles.LoadFile ("E:\Martial Arts Database\Martial Arts Database Help Files.rtf")
   
   
End Sub

It displays the rtfFile with all the links in blue very well at design time, but at run time its gibberish.

I'm still searching for a clue but would appreciate some help.
Reagards Ned
0
Ned_Kelly
Asked:
Ned_Kelly
  • 3
  • 2
  • 2
  • +1
1 Solution
 
LarsCommented:
If you save it in Word as a RTF file and then open it in a RTF box there should be no problem.
You should use rtfHelpFiles.FileName c:.......
0
 
LarsCommented:
Just to  be correct rtfHelpFiles.FileName "E:\Martial Arts Database\Martial Arts Database Help Files.rtf"

0
 
rmichelsCommented:
The VB rich text control is based off of version 1.0 of the RTF windows control.  Word uses up to version 3.0 of the RTF spec.  You may have some control codes that are not supported in the VB control?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Valliappan ANSenior Tech ConsultantCommented:
As rmichels has pointed out, Rich text box control, supports, not all the control codes that are displayed in Word. But still you would be able to view the RTF file, with whatever codes, that the Rich text box, supports. If need be you could have a look at the control codes supported by VB Rich text box, in MSDN.

Do you load the file in design time or runtime? You have mentioned that it works in design time, but not in runtime?

Cheers.
0
 
Ned_KellyAuthor Commented:
Thanks Lars, the end result was
rtfHelpFiles.LoadFile "E:\Martial Arts Database\Martial Arts Database Help Files.rtf"

I tried the .FileName but it kept coming up with an error.
I have taken out the brackets and it loads nicely now, though the crossreferencing in word doesn't work, I would have thought that it would enable cross referencing in the rtfbox, maybe its just me, but I can read my help files now though. Still a bit to do.

I didn't get a copy of MSDN with my copy of vis studio 6, it is registered and a legal copy but three cd's and no MSDN.

I'll do some searching on the net later.
Thanks everybody,
Regards Ned
0
 
Valliappan ANSenior Tech ConsultantCommented:
Ned,

Look at these links for help on RTF:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rtfbox98/html/vbconsupportedrtfcodes.asp
(Supported RTF Codes)

and

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rtfbox98/dt_vbconSupportedRtfCodesC.asp
(The methods/properties that were discussed and Rich Text box control links)

Hope this helps,
Cheers.
0
 
Ned_KellyAuthor Commented:
Thanks to everybody for the comments, I'm going to accept Lars comment as the answer, because he sparked me to leave of the brackets, which led to the loading of a readable file.
Thanks to Valli An for the links, they have been bookmarked and files saved.
Hopefully one day I will be able to answer somebody's question and the tide will turn.
Regards Ned
0
 
Valliappan ANSenior Tech ConsultantCommented:
All the best, Ned.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now