Link to home
Start Free TrialLog in
Avatar of RIAS
RIASFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Richtextbox formatting

Hello,
How can I format text in the richtextbox.
I am using vb.net 2014 windows.

Need to make text bold and change font on some words.
Cheers
ASKER CERTIFIED SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RIAS

ASKER

Andy,
Where do I add  this code?
Also look at
https://en.wikipedia.org/wiki/Rich_Text_Format

There is an example where the font is specified.

ps.  Rtf format AFAIK isn't going to be further developed, it seems like HTML formats are replacing it.
>>Where do I add  this code?

eg. FormLoad event, the rtf textbox needs to have been created when you specify the formatted text.  Note you need to use the Rtf property not the Text property.  The Rtf displays the formatted text according to the string, the Text property just treats it as a string without displaying any formatting.
Avatar of RIAS

ASKER

Cheers mate!
Avatar of RIAS

ASKER

Andy,
How can I add new line and a picture to it?
Cheers
New line is \r\n
Picture - I don't know offhand.  What you could do is open winword, put a picture in then save the document as rtf.  Inspect the file you saved with notepad (which does not format the file in the editor window).
Avatar of RIAS

ASKER

Cool Andy ,will try!