Text formatting inside a RichTextox control

On my windows form I have two RichtextBox controls displaying a large amount of text. i want to format some of the words, making them bold, and for some changing font color or size for a paragraph. How can I do that?
LVL 35
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Anil GolamariCommented:
You can use something like this

richTextBox1.Rtf = @"{\rtf1\ansi Example to make the char's in a string as \b bold\b0.}";

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
YZlatAuthor Commented:
lucky85, is there a way to make text underlined? Change text font for a paragraph?

I tired using \u \u0 but didn't work
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

YZlatAuthor Commented:
To be honest thos links were not helpful. Too much stuff to go through and I still didn't find anything there. I found some stuff here http://www.pindari.com/rtf1.html

Could you help me with creating a hyperlink in richtextbox?

something equivalent to <a href="http://www.google.com">goole</a>
Anil GolamariCommented:
set the DetectUrls property to true. This should create Hyperlink as soon as you enter some text with http:// and will open with your default browser.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;

namespace WindowsFormsApplication1 {
    public partial class Form1 : Form {
        public Form1() {

        private void richTextBox1_LinkClicked(object sender, LinkClickedEventArgs e) {


Open in new window

YZlatAuthor Commented:
The thing is, I set the text of the RichTextBox the following way:

RichTextBox1.Rtf="{...... http://www.google.com .....}";

How do I make http://www.google.com to show up as hyperlink? No one enters the text into textbox, in fact, it is read-only
Anil GolamariCommented:
Here I made this text as read only and when you hit on the Text Press Here it will be re-directed to google.com as your application needs. You can use that piece of code and modify the text lable.
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
            MessageBox.Show("Press here!");  

        private void Form1_Load(object sender, EventArgs e)
            linkLabel1.Text = "Press Here";
            linkLabel1.AutoSize = true;
            linkLabel1.Location = this.richTextBox1.GetPositionFromCharIndex(this.richTextBox1.TextLength);
            this.richTextBox1.AppendText(linkLabel1.Text + "   ");
            this.richTextBox1.SelectionStart = this.richTextBox1.TextLength;

Open in new window

YZlatAuthor Commented:
Thanks for your help but my question was not answered completely
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.