Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 215
  • Last Modified:

How change font in Rich Text Box?

I have a RichTextBox control on a vb 6 form.  When I load the RTF control from a file, I want some lines to be BOLD and UNDERLINE and other lines to be normal.

How do I do that?

Thanks
0
EYoung
Asked:
EYoung
1 Solution
 
DessieD32Commented:
Hi EYoung

Assuming you know the particular strings etc that you want to apply formatting to, you could do something like the following

rtb.SelStart = 2
rtb.SelLength = 5
rtb.SelUnderline = True
rtb.SelBold = True
rtb.SelFontName = "Arial"

After loading the file, you can use "InStr" to determine the SelStart value, and the length of the string to determine SelLength, then just apply the formatting using the Sel... methods.

0
 
EYoungAuthor Commented:
I'll be back at that client's offices tomorrow and will try the suggestions then.  Thanks
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now