Link to home
Create AccountLog 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
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
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!